Merge workers into API
This commit is contained in:
@@ -97,11 +97,11 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
if (botStatus == BotStatus.Running && _tradingBot == null)
|
||||
{
|
||||
// Now, we can proceed with resuming the bot.
|
||||
await ResumeBotInternalAsync();
|
||||
await ResumeBotInternalAsync(botStatus);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ResumeBotInternalAsync()
|
||||
private async Task ResumeBotInternalAsync(BotStatus previousStatus)
|
||||
{
|
||||
// Idempotency check
|
||||
if (_tradingBot != null)
|
||||
@@ -113,7 +113,7 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
{
|
||||
// Create and initialize trading bot instance
|
||||
_tradingBot = CreateTradingBotInstance(_state.State.Config);
|
||||
await _tradingBot.Start();
|
||||
await _tradingBot.Start(previousStatus);
|
||||
|
||||
// Set startup time when bot actually starts running
|
||||
_state.State.StartupTime = DateTime.UtcNow;
|
||||
@@ -155,7 +155,7 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
try
|
||||
{
|
||||
// Resume the bot - this handles registry status update internally
|
||||
await ResumeBotInternalAsync();
|
||||
await ResumeBotInternalAsync(status);
|
||||
_logger.LogInformation("LiveTradingBotGrain {GrainId} started successfully", this.GetPrimaryKey());
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user