mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
catch cancled task exception in notif
This commit is contained in:
@@ -78,19 +78,23 @@ namespace BTCPayServer.Controllers
|
|||||||
IEventAggregatorSubscription subscription = null;
|
IEventAggregatorSubscription subscription = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
subscription = _eventAggregator.Subscribe<UserNotificationsUpdatedEvent>(async evt =>
|
subscription = _eventAggregator.Subscribe<UserNotificationsUpdatedEvent>(async evt =>
|
||||||
{
|
{
|
||||||
if (evt.UserId == userId)
|
if (evt.UserId == userId)
|
||||||
{
|
{
|
||||||
await websocketHelper.Send("update");
|
await websocketHelper.Send("update");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
while (!cancellationToken.IsCancellationRequested)
|
while (!cancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
await Task.Delay(2000, cancellationToken);
|
await Task.Delay(2000, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(TaskCanceledException)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
subscription?.Dispose();
|
subscription?.Dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user