Fix reminding for livetradingbot
This commit is contained in:
@@ -4,17 +4,35 @@ using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.Grains;
|
||||
|
||||
public class PriceFetcherInitializer : IHostedService
|
||||
public class GrainInitializer : IHostedService
|
||||
{
|
||||
private readonly IGrainFactory _grainFactory;
|
||||
|
||||
public PriceFetcherInitializer(IClusterClient grainFactory)
|
||||
public GrainInitializer(IClusterClient grainFactory)
|
||||
{
|
||||
_grainFactory = grainFactory;
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await InitializePriceFetcherAsync();
|
||||
await InitializeBotRemindersAsync();
|
||||
}
|
||||
|
||||
public async Task InitializeBotRemindersAsync()
|
||||
{
|
||||
if (Environment.GetEnvironmentVariable("TASK_SLOT") != "1")
|
||||
return;
|
||||
|
||||
var grain = _grainFactory.GetGrain<IBotReminderInitializerGrain>(0);
|
||||
await grain.InitializeBotRemindersAsync();
|
||||
}
|
||||
|
||||
public async Task InitializePriceFetcherAsync()
|
||||
{
|
||||
if (Environment.GetEnvironmentVariable("TASK_SLOT") != "1")
|
||||
return;
|
||||
|
||||
// Initialize grains for different timeframes
|
||||
var timeframes = new[]
|
||||
{
|
||||
Reference in New Issue
Block a user