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:
parent
242e509b9d
commit
ba2c7fe67d
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user