Commit afaa1281 authored by Savorboard's avatar Savorboard

Suppression MySql Connect Timeout expired exception in linux. #451

parent dcb7f198
......@@ -53,15 +53,13 @@ namespace DotNetCore.CAP.Processor
_cts.Cancel();
}
private void Sending()
private async Task Sending()
{
try
{
while (!_publishedMessageQueue.IsCompleted)
{
if (_publishedMessageQueue.TryTake(out var message, 3000, _cts.Token))
{
Task.Run(async () =>
{
try
{
......@@ -75,7 +73,6 @@ namespace DotNetCore.CAP.Processor
{
_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)
......
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