mirror of
https://github.com/bitwarden/server
synced 2025-12-19 09:43:25 +00:00
catch any unhandled exceptions in event processor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user