Converted MetricsPublisher into hosted service
@@ -269,6 +269,10 @@ namespace Miningcore
else
services.AddHostedService<ShareRelay>();
+
+ // start API
+ if(clusterConfig.Api == null || clusterConfig.Api.Enabled)
+ services.AddHostedService<MetricsPublisher>();
}
private static IHost host;
@@ -327,12 +331,6 @@ namespace Miningcore
poolConfig.Template = template;
}
- // start API
- if(clusterConfig.Api == null || clusterConfig.Api.Enabled)
- {
- container.Resolve<MetricsPublisher>();
- }
-
// start payment processor
if(clusterConfig.PaymentProcessing?.Enabled == true &&
clusterConfig.Pools.Any(x => x.PaymentProcessing?.Enabled == true))
