Make sure btcpay does not wait all the invoces to be cleaned to start

This commit is contained in:
nicolas.dorier 2018-04-30 15:39:47 +09:00
parent af0eb831a2
commit 9339c7dff2

View File

@ -261,6 +261,7 @@ namespace BTCPayServer.HostedServices
private async Task WaitPendingInvoices()
{
await new SynchronizationContextRemover();
await Task.WhenAll((await _InvoiceRepository.GetPendingInvoices())
.Select(id => Wait(id)).ToArray());
_WaitingInvoices = null;
@ -268,8 +269,8 @@ namespace BTCPayServer.HostedServices
async Task StartLoop(CancellationToken cancellation)
{
await new SynchronizationContextRemover();
Logs.PayServer.LogInformation("Start watching invoices");
await Task.Delay(1).ConfigureAwait(false); // Small hack so that the caller does not block on GetConsumingEnumerable
try
{
foreach (var invoiceId in _WatchRequests.GetConsumingEnumerable(cancellation))