1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-08 06:28:14 -05:00

Revert "some logging from queue service"

This reverts commit 263dfda9c42a36428ad4aac4f77d0367a20a379c.
This commit is contained in:
Kyle Spearrin 2018-08-24 11:32:53 -04:00
parent 263dfda9c4
commit 46b9400f9f

View File

@ -60,34 +60,26 @@ namespace Bit.Notifications
var queueClient = storageAccount.CreateCloudQueueClient(); var queueClient = storageAccount.CreateCloudQueueClient();
_queue = queueClient.GetQueueReference("notifications"); _queue = queueClient.GetQueueReference("notifications");
_logger.LogInformation("starting queue read"); while(!cancellationToken.IsCancellationRequested)
try
{ {
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), foreach(var message in messages)
null, null, cancellationToken);
if(messages.Any())
{ {
foreach(var message in messages) var notificationJson = message.AsString;
{ var notification = JsonConvert.DeserializeObject<PushNotificationData<object>>(
var notificationJson = message.AsString; notificationJson);
var notification = JsonConvert.DeserializeObject<PushNotificationData<object>>( await HubHelpers.SendNotificationToHubAsync(notification.Type, notificationJson,
notificationJson); _hubContext, cancellationToken);
await HubHelpers.SendNotificationToHubAsync(notification.Type, notificationJson, await _queue.DeleteMessageAsync(message);
_hubContext, cancellationToken);
await _queue.DeleteMessageAsync(message);
}
}
else
{
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
} }
} }
} else
catch(Exception e) {
{ await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
_logger.LogError(e, "error from queue"); }
} }
} }
} }