From 59afc056615db868c6b8f330b6cd205bb092d3be Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 19 Oct 2019 14:12:43 +0900 Subject: [PATCH] Log hosted services exiting --- BTCPayServer/HostedServices/BaseAsyncService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/BTCPayServer/HostedServices/BaseAsyncService.cs b/BTCPayServer/HostedServices/BaseAsyncService.cs index 1bc6ca2ec..7236ae99d 100644 --- a/BTCPayServer/HostedServices/BaseAsyncService.cs +++ b/BTCPayServer/HostedServices/BaseAsyncService.cs @@ -57,12 +57,14 @@ namespace BTCPayServer.HostedServices } } - public Task StopAsync(CancellationToken cancellationToken) + public async Task StopAsync(CancellationToken cancellationToken) { - if (_Cts == null) - return Task.CompletedTask; - _Cts.Cancel(); - return Task.WhenAll(_Tasks); + if (_Cts != null) + { + _Cts.Cancel(); + await Task.WhenAll(_Tasks); + } + Logs.PayServer.LogInformation($"{this.GetType().Name} successfully exited..."); } } }