Skip to content

Commit

Permalink
async await
Browse files Browse the repository at this point in the history
  • Loading branch information
phongnguyend committed Dec 5, 2024
1 parent a7ec744 commit b0c4e28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public MessageBusConsumerBackgroundService(ILogger<MessageBusConsumerBackgroundS
_messageBus = messageBus;
}

protected override Task ExecuteAsync(CancellationToken stoppingToken)
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_messageBus.ReceiveAsync<TConsumer, T>(stoppingToken);
return Task.CompletedTask;
await _messageBus.ReceiveAsync<TConsumer, T>(stoppingToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public MessageBusConsumerBackgroundService(ILogger<MessageBusConsumerBackgroundS
_messageBus = messageBus;
}

protected override Task ExecuteAsync(CancellationToken cancellationToken)
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_messageBus.ReceiveAsync<TConsumer, T>(cancellationToken);
return Task.CompletedTask;
await _messageBus.ReceiveAsync<TConsumer, T>(stoppingToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public MessageBusConsumerBackgroundService(ILogger<MessageBusConsumerBackgroundS
_messageBus = messageBus;
}

protected override Task ExecuteAsync(CancellationToken stoppingToken)
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_messageBus.ReceiveAsync<TConsumer, T>(stoppingToken);
return Task.CompletedTask;
await _messageBus.ReceiveAsync<TConsumer, T>(stoppingToken);
}
}

0 comments on commit b0c4e28

Please sign in to comment.