From 46b9400f9fadcc648e6640e231fd7cc08cce799a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 24 Aug 2018 11:32:53 -0400 Subject: [PATCH] Revert "some logging from queue service" This reverts commit 263dfda9c42a36428ad4aac4f77d0367a20a379c. --- src/Notifications/AzureQueueHostedService.cs | 38 ++++++++------------ 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/Notifications/AzureQueueHostedService.cs b/src/Notifications/AzureQueueHostedService.cs index df67d6bd23..05baf77cf6 100644 --- a/src/Notifications/AzureQueueHostedService.cs +++ b/src/Notifications/AzureQueueHostedService.cs @@ -60,34 +60,26 @@ namespace Bit.Notifications var queueClient = storageAccount.CreateCloudQueueClient(); _queue = queueClient.GetQueueReference("notifications"); - _logger.LogInformation("starting queue read"); - try + while(!cancellationToken.IsCancellationRequested) { - while(!cancellationToken.IsCancellationRequested) + var messages = await _queue.GetMessagesAsync(32, TimeSpan.FromMinutes(1), + null, null, cancellationToken); + if(messages.Any()) { - var messages = await _queue.GetMessagesAsync(32, TimeSpan.FromMinutes(1), - null, null, cancellationToken); - if(messages.Any()) + foreach(var message in messages) { - foreach(var message in messages) - { - var notificationJson = message.AsString; - var notification = JsonConvert.DeserializeObject>( - notificationJson); - await HubHelpers.SendNotificationToHubAsync(notification.Type, notificationJson, - _hubContext, cancellationToken); - await _queue.DeleteMessageAsync(message); - } - } - else - { - await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken); + var notificationJson = message.AsString; + var notification = JsonConvert.DeserializeObject>( + notificationJson); + await HubHelpers.SendNotificationToHubAsync(notification.Type, notificationJson, + _hubContext, cancellationToken); + await _queue.DeleteMessageAsync(message); } } - } - catch(Exception e) - { - _logger.LogError(e, "error from queue"); + else + { + await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken); + } } } }