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); } } }