Do not use HttpClient singleton for the InvoiceNotifcationManager

This commit is contained in:
nicolas.dorier
2019-04-05 14:31:09 +09:00
parent eb5e32a07f
commit ea8196b532

View File

@@ -24,7 +24,7 @@ namespace BTCPayServer.HostedServices
{ {
public class InvoiceNotificationManager : IHostedService public class InvoiceNotificationManager : IHostedService
{ {
public static HttpClient _Client = new HttpClient(); HttpClient _Client;
public class ScheduledJob public class ScheduledJob
{ {
@@ -46,6 +46,7 @@ namespace BTCPayServer.HostedServices
private readonly EmailSenderFactory _EmailSenderFactory; private readonly EmailSenderFactory _EmailSenderFactory;
public InvoiceNotificationManager( public InvoiceNotificationManager(
IHttpClientFactory httpClientFactory,
IBackgroundJobClient jobClient, IBackgroundJobClient jobClient,
EventAggregator eventAggregator, EventAggregator eventAggregator,
InvoiceRepository invoiceRepository, InvoiceRepository invoiceRepository,
@@ -53,6 +54,7 @@ namespace BTCPayServer.HostedServices
ILogger<InvoiceNotificationManager> logger, ILogger<InvoiceNotificationManager> logger,
EmailSenderFactory emailSenderFactory) EmailSenderFactory emailSenderFactory)
{ {
_Client = httpClientFactory.CreateClient();
_JobClient = jobClient; _JobClient = jobClient;
_EventAggregator = eventAggregator; _EventAggregator = eventAggregator;
_InvoiceRepository = invoiceRepository; _InvoiceRepository = invoiceRepository;