Commit 120b7946 authored by Savorboard's avatar Savorboard

Fixed exception thrown when terminate the program with Ctrl+C. (#130)

parent 31a09d2b
...@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ...@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
CHANGELOG.md = CHANGELOG.md CHANGELOG.md = CHANGELOG.md
CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md
ConfigureMSDTC.ps1 = ConfigureMSDTC.ps1 ConfigureMSDTC.ps1 = ConfigureMSDTC.ps1
.github\ISSUE_TEMPLATE = .github\ISSUE_TEMPLATE
LICENSE.txt = LICENSE.txt LICENSE.txt = LICENSE.txt
README.md = README.md README.md = README.md
README.zh-cn.md = README.zh-cn.md README.zh-cn.md = README.zh-cn.md
......
...@@ -57,13 +57,14 @@ namespace DotNetCore.CAP.Processor ...@@ -57,13 +57,14 @@ namespace DotNetCore.CAP.Processor
return; return;
} }
try
{
_disposed = true; _disposed = true;
_logger.ServerShuttingDown(); _logger.ServerShuttingDown();
_cts.Cancel(); _cts.Cancel();
try
{ _compositeTask?.Wait((int)TimeSpan.FromSeconds(10).TotalMilliseconds);
_compositeTask.Wait((int) TimeSpan.FromSeconds(10).TotalMilliseconds);
} }
catch (AggregateException ex) catch (AggregateException ex)
{ {
...@@ -73,6 +74,10 @@ namespace DotNetCore.CAP.Processor ...@@ -73,6 +74,10 @@ namespace DotNetCore.CAP.Processor
_logger.ExpectedOperationCanceledException(innerEx); _logger.ExpectedOperationCanceledException(innerEx);
} }
} }
catch (Exception ex)
{
_logger.LogWarning(ex, "An exception was occured when disposing...");
}
} }
private IProcessor InfiniteRetry(IProcessor inner) private IProcessor InfiniteRetry(IProcessor inner)
......
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