mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
catch cancled task exception in notif
This commit is contained in:
parent
dc43b54892
commit
a0065bc2ba
1 changed files with 6 additions and 2 deletions
|
@ -78,19 +78,23 @@ namespace BTCPayServer.Controllers
|
|||
IEventAggregatorSubscription subscription = null;
|
||||
try
|
||||
{
|
||||
subscription = _eventAggregator.Subscribe<UserNotificationsUpdatedEvent>(async evt =>
|
||||
subscription = _eventAggregator.Subscribe<UserNotificationsUpdatedEvent>(async evt =>
|
||||
{
|
||||
if (evt.UserId == userId)
|
||||
{
|
||||
await websocketHelper.Send("update");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
await Task.Delay(2000, cancellationToken);
|
||||
}
|
||||
}
|
||||
catch(TaskCanceledException)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
finally
|
||||
{
|
||||
subscription?.Dispose();
|
||||
|
|
Loading…
Add table
Reference in a new issue