mirror of
https://github.com/bitwarden/server.git
synced 2025-07-08 03:15:07 -05:00
Changed all C# control flow block statements to include space between keyword and open paren
This commit is contained in:
@ -43,7 +43,7 @@ namespace Bit.EventsProcessor
|
||||
|
||||
public async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if(_executingTask == null)
|
||||
if (_executingTask == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -59,7 +59,7 @@ namespace Bit.EventsProcessor
|
||||
private async Task ExecuteAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var storageConnectionString = _configuration["azureStorageConnectionString"];
|
||||
if(string.IsNullOrWhiteSpace(storageConnectionString))
|
||||
if (string.IsNullOrWhiteSpace(storageConnectionString))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -68,14 +68,14 @@ namespace Bit.EventsProcessor
|
||||
_eventWriteService = new RepositoryEventWriteService(repo);
|
||||
_queueClient = new QueueClient(storageConnectionString, "event");
|
||||
|
||||
while(!cancellationToken.IsCancellationRequested)
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
var messages = await _queueClient.ReceiveMessagesAsync(32);
|
||||
if(messages.Value?.Any() ?? false)
|
||||
if (messages.Value?.Any() ?? false)
|
||||
{
|
||||
foreach(var message in messages.Value)
|
||||
foreach (var message in messages.Value)
|
||||
{
|
||||
await ProcessQueueMessageAsync(message.MessageText, cancellationToken);
|
||||
await _queueClient.DeleteMessageAsync(message.MessageId, message.PopReceipt);
|
||||
@ -86,7 +86,7 @@ namespace Bit.EventsProcessor
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Exception occurred: " + e.Message);
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
||||
@ -98,7 +98,7 @@ namespace Bit.EventsProcessor
|
||||
|
||||
public async Task ProcessQueueMessageAsync(string message, CancellationToken cancellationToken)
|
||||
{
|
||||
if(_eventWriteService == null || message == null || message.Length == 0)
|
||||
if (_eventWriteService == null || message == null || message.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -109,13 +109,13 @@ namespace Bit.EventsProcessor
|
||||
var events = new List<IEvent>();
|
||||
|
||||
var token = JToken.Parse(message);
|
||||
if(token is JArray)
|
||||
if (token is JArray)
|
||||
{
|
||||
var indexedEntities = token.ToObject<List<EventMessage>>()
|
||||
.SelectMany(e => EventTableEntity.IndexEvent(e));
|
||||
events.AddRange(indexedEntities);
|
||||
}
|
||||
else if(token is JObject)
|
||||
else if (token is JObject)
|
||||
{
|
||||
var eventMessage = token.ToObject<EventMessage>();
|
||||
events.AddRange(EventTableEntity.IndexEvent(eventMessage));
|
||||
@ -124,11 +124,11 @@ namespace Bit.EventsProcessor
|
||||
await _eventWriteService.CreateManyAsync(events);
|
||||
_logger.LogInformation("Processed message.");
|
||||
}
|
||||
catch(JsonReaderException)
|
||||
catch (JsonReaderException)
|
||||
{
|
||||
_logger.LogError("JsonReaderException: Unable to parse message.");
|
||||
}
|
||||
catch(JsonSerializationException)
|
||||
catch (JsonSerializationException)
|
||||
{
|
||||
_logger.LogError("JsonSerializationException: Unable to serialize token.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user