From 9d406923aea18069cf86670da0be87af50d90ce8 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 17 Feb 2018 01:43:43 +0900 Subject: [PATCH] make sure the waitingInvoices tasks are done --- BTCPayServer/HostedServices/InvoiceWatcher.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/HostedServices/InvoiceWatcher.cs b/BTCPayServer/HostedServices/InvoiceWatcher.cs index 6c468aef8..37d76e02f 100644 --- a/BTCPayServer/HostedServices/InvoiceWatcher.cs +++ b/BTCPayServer/HostedServices/InvoiceWatcher.cs @@ -331,7 +331,8 @@ namespace BTCPayServer.HostedServices { leases.Dispose(); _Cts.Cancel(); - return _Loop; + var waitingPendingInvoices = _WaitingInvoices ?? Task.CompletedTask; + return Task.WhenAll(waitingPendingInvoices, _Loop); } } }