[Bug] If a altcoins is disabled from BTCPay and payout processor is used, it would crash at restart (#4997)

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
This commit is contained in:
Nicolas Dorier 2023-05-25 19:42:23 +09:00 committed by GitHub
parent 2c4349c630
commit 3d5361cd11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,7 +136,16 @@ public class PayoutProcessorService : EventHostedServiceBase
if (matchedProcessor is not null)
{
await StopProcessor(data.Id, cancellationToken);
var processor = await matchedProcessor.ConstructProcessor(data);
IHostedService processor = null;
try
{
processor = await matchedProcessor.ConstructProcessor(data);
}
catch(Exception ex)
{
Logs.PayServer.LogWarning(ex, $"Payout processor ({data.PaymentMethod}) failed to start. Skipping...");
return;
}
await processor.StartAsync(cancellationToken);
Services.TryAdd(data.Id, processor);
}