Commit d1c26b75 authored by Savorboard's avatar Savorboard

Fixed asynchronous exception catching bug of sending.

parent f664b628
...@@ -59,17 +59,17 @@ namespace DotNetCore.CAP.Processor ...@@ -59,17 +59,17 @@ namespace DotNetCore.CAP.Processor
{ {
if (_publishedMessageQueue.TryTake(out var message, 3000, _cts.Token)) if (_publishedMessageQueue.TryTake(out var message, 3000, _cts.Token))
{ {
try Task.Run(async () =>
{ {
Task.Run(async () => try
{ {
await _sender.SendAsync(message); await _sender.SendAsync(message);
}); }
} catch (Exception ex)
catch (Exception ex) {
{ _logger.LogError(ex, $"An exception occurred when sending a message to the MQ. Topic:{message.Name}, Id:{message.Id}");
_logger.LogError(ex, $"An exception occurred when sending a message to the MQ. Topic:{message.Name}, Id:{message.Id}"); }
} });
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment