public async Task SendPendingMessagesAsync(long nodeId) { try { var nodeConnection = _connectionsService.GetNodeConnection(nodeId); if (nodeConnection != null) { var pendingMessages = await _pendingMessagesService.GetNodePendingMessagesAsync(nodeId).ConfigureAwait(false); if (pendingMessages != null && pendingMessages.Any()) { foreach (var message in pendingMessages) { await SendNoticeToNodeAsync( nodeConnection, ObjectSerializer.ByteArrayToObject <NodeNotice>(Convert.FromBase64String(message.Content))).ConfigureAwait(false); } await _pendingMessagesService.RemovePendingMessagesAsync(pendingMessages.Select(message => message.Id)).ConfigureAwait(false); } } } catch (Exception ex) { Logger.WriteLog(ex); } }
private async void SendPendingMessagesAsync() { try { var pendingMessages = await pendingMessagesService.GetUserPendingMessagesAsync(clientConnection.UserId.Value).ConfigureAwait(false); await pendingMessagesService.RemovePendingMessagesAsync(pendingMessages.Select(message => message.Id)).ConfigureAwait(false); noticeService.SendPendingMessagesAsync(pendingMessages, clientConnection.UserId.Value); } catch (Exception ex) { Logger.WriteLog(ex); } }