瀏覽代碼

Suppression MySql Connect Timeout expired exception in linux. #451

master
Savorboard 5 年之前
父節點
當前提交
afaa128139
共有 1 個文件被更改,包括 12 次插入15 次删除
  1. +12
    -15
      src/DotNetCore.CAP/Processor/IDispatcher.Default.cs

+ 12
- 15
src/DotNetCore.CAP/Processor/IDispatcher.Default.cs 查看文件

@@ -53,7 +53,7 @@ namespace DotNetCore.CAP.Processor
_cts.Cancel();
}

private void Sending()
private async Task Sending()
{
try
{
@@ -61,21 +61,18 @@ namespace DotNetCore.CAP.Processor
{
if (_publishedMessageQueue.TryTake(out var message, 3000, _cts.Token))
{
Task.Run(async () =>
try
{
try
var result = await _sender.SendAsync(message);
if (!result.Succeeded)
{
var result = await _sender.SendAsync(message);
if (!result.Succeeded)
{
_logger.MessagePublishException(message.Origin.GetId(), result.ToString(), result.Exception);
}
_logger.MessagePublishException(message.Origin.GetId(), result.ToString(), result.Exception);
}
catch (Exception ex)
{
_logger.LogError(ex, $"An exception occurred when sending a message to the MQ. Id:{message.DbId}");
}
});
}
catch (Exception ex)
{
_logger.LogError(ex, $"An exception occurred when sending a message to the MQ. Id:{message.DbId}");
}
}
}
}
@@ -85,13 +82,13 @@ namespace DotNetCore.CAP.Processor
}
}

private void Processing()
private async Task Processing()
{
try
{
foreach (var message in _receivedMessageQueue.GetConsumingEnumerable(_cts.Token))
{
_executor.DispatchAsync(message.Item1, message.Item2, _cts.Token);
await _executor.DispatchAsync(message.Item1, message.Item2, _cts.Token);
}
}
catch (OperationCanceledException)


Loading…
取消
儲存