From 978b7d930e0104f48a491140f825ff1f9e11bee0 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 29 Mar 2019 18:09:54 +0900 Subject: [PATCH] Catch operation cancelled exception on the BackgroundJobScheduler --- .../BackgroundJobSchedulerHostedService.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs b/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs index 28fde9d3d..5c4ff50cb 100644 --- a/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs +++ b/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs @@ -45,7 +45,14 @@ namespace BTCPayServer.HostedServices { } - await BackgroundJobClient.WaitAllRunning(cancellationToken); + try + { + await BackgroundJobClient.WaitAllRunning(cancellationToken); + } + catch (OperationCanceledException) + { + + } } } @@ -91,6 +98,8 @@ namespace BTCPayServer.HostedServices Task[] processing = null; lock (_Processing) { + if (_Processing.Count == 0) + return; processing = _Processing.ToArray(); }