Update status to match UI

This commit is contained in:
2025-08-14 18:08:31 +07:00
parent e4049045c3
commit 6a2e4e81b1
18 changed files with 111 additions and 62 deletions

View File

@@ -52,12 +52,12 @@ namespace Managing.Application.ManageBot
{
var grain = _grainFactory.GetGrain<ILiveTradingBotGrain>(identifier);
await grain.StopAsync();
return BotStatus.Down;
return BotStatus.Stopped;
}
catch (Exception e)
{
_tradingBotLogger.LogError(e, "Error stopping bot {Identifier}", identifier);
return BotStatus.Down;
return BotStatus.Stopped;
}
}
@@ -97,13 +97,13 @@ namespace Managing.Application.ManageBot
var previousStatus = await registryGrain.GetBotStatus(identifier);
// If bot is already up, return the status directly
if (previousStatus == BotStatus.Up)
if (previousStatus == BotStatus.Running)
{
return BotStatus.Up;
return BotStatus.Running;
}
var botGrain = _grainFactory.GetGrain<ILiveTradingBotGrain>(identifier);
if (previousStatus == BotStatus.None)
if (previousStatus == BotStatus.Saved)
{
// First time startup
await botGrain.StartAsync();
@@ -134,12 +134,12 @@ namespace Managing.Application.ManageBot
await _messengerService.SendTradeMessage(restartMessage, false, account.User);
}
return BotStatus.Up;
return BotStatus.Running;
}
catch (Exception e)
{
_tradingBotLogger.LogError(e, "Error restarting bot {Identifier}", identifier);
return BotStatus.Down;
return BotStatus.Stopped;
}
}
@@ -190,7 +190,7 @@ namespace Managing.Application.ManageBot
public async Task<IEnumerable<string>> GetActiveBotsNamesAsync()
{
var bots = await _botRepository.GetBotsByStatusAsync(BotStatus.Up);
var bots = await _botRepository.GetBotsByStatusAsync(BotStatus.Running);
return bots.Select(b => b.Name);
}