1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-31 18:27:49 +01:00

Revert "some logging from queue service"

This reverts commit 263dfda9c4.
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();
_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<PushNotificationData<object>>(
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<PushNotificationData<object>>(
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);
}
}
}
}