Browse Source

Add try catch on Dispatcher.Processing when invoke subscriber (#900)

* Fix Dashboard metric not update #811

* Add try catch on Dispatcher.Processing when invoke subscriber
master
luox78 3 years ago
committed by GitHub
parent
commit
1bc1595a97
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/DotNetCore.CAP/Processor/IDispatcher.Default.cs

+ 9
- 1
src/DotNetCore.CAP/Processor/IDispatcher.Default.cs View File

@@ -98,7 +98,15 @@ namespace DotNetCore.CAP.Processor
{
while (_receivedChannel.Reader.TryRead(out var message))
{
await _executor.DispatchAsync(message.Item1, message.Item2, _cts.Token);
try
{
await _executor.DispatchAsync(message.Item1, message.Item2, _cts.Token);
}
catch (Exception e)
{
_logger.LogError(e,
$"An exception occurred when invoke subscriber. MessageId:{message.Item1.DbId}");
}
}
}
}


Loading…
Cancel
Save