1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-22 12:04:27 -05:00

catch any unhandled exceptions in event processor

This commit is contained in:
Kyle Spearrin 2019-07-11 15:43:20 -04:00
parent 242e509b9d
commit ba2c7fe67d

View File

@ -70,6 +70,8 @@ namespace Bit.EventsProcessor
_queue = queueClient.GetQueueReference("event");
while(!cancellationToken.IsCancellationRequested)
{
try
{
var messages = await _queue.GetMessagesAsync(32, TimeSpan.FromMinutes(1),
null, null, cancellationToken);
@ -86,6 +88,12 @@ namespace Bit.EventsProcessor
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
}
catch(Exception e)
{
_logger.LogError(e, "Exception occurred: " + e.Message);
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
}
}
public async Task ProcessQueueMessageAsync(string message, CancellationToken cancellationToken)
@ -124,11 +132,6 @@ namespace Bit.EventsProcessor
{
_logger.LogError("JsonSerializationException: Unable to serialize token.");
}
catch(Exception e)
{
_logger.LogError(e, "Exception occurred. " + e.Message);
throw e;
}
}
}
}