Improve logs of the invoice text search import

This commit is contained in:
nicolas.dorier 2021-01-11 23:41:05 +09:00
parent f027d36db8
commit eedf189d44
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -61,10 +61,10 @@ namespace BTCPayServer.HostedServices
var totalCount = await _invoiceRepository.GetInvoicesTotal(invoiceQuery);
const int PAGE_SIZE = 1000;
var totalPages = Math.Ceiling(totalCount * 1.0m / PAGE_SIZE);
Logs.PayServer.LogInformation($"Importing {totalCount} invoices into the text search table in {totalPages - startFromPage} pages");
Logs.PayServer.LogInformation($"Importing {totalCount} invoices into the search table in {totalPages - startFromPage} pages");
for (int i = startFromPage; i < totalPages && !CancellationToken.IsCancellationRequested; i++)
{
Logs.PayServer.LogInformation($"Import to text search table progress: {i}/{totalPages} pages");
Logs.PayServer.LogInformation($"Import to search table progress: {i + 1}/{totalPages} pages");
// migrate data to new table using invoices from database
using var ctx = _dbContextFactory.CreateContext();
invoiceQuery.Skip = i * PAGE_SIZE;
@ -116,6 +116,7 @@ namespace BTCPayServer.HostedServices
_settingsRepository.UpdateSettingInContext(ctx, settings);
await ctx.SaveChangesAsync();
}
Logs.PayServer.LogInformation($"Full invoice search import successful");
}
}
}