Make sure the invoice migration loop can be interrupted

This commit is contained in:
nicolas.dorier 2020-12-28 19:12:38 +09:00
parent 39b5462809
commit f64f86fbb6
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -49,7 +49,7 @@ namespace BTCPayServer.HostedServices
var totalCount = await _invoiceRepository.GetInvoicesTotal(invoiceQuery);
const int PAGE_SIZE = 1000;
var totalPages = Math.Ceiling(totalCount * 1.0m / PAGE_SIZE);
for (int i = startFromPage; i < totalPages; i++)
for (int i = startFromPage; i < totalPages && !CancellationToken.IsCancellationRequested; i++)
{
invoiceQuery.Skip = i * PAGE_SIZE;
invoiceQuery.Take = PAGE_SIZE;