Fix concurrency

This commit is contained in:
2025-08-14 17:49:05 +07:00
parent aacb92018f
commit e4049045c3

View File

@@ -301,16 +301,6 @@ namespace Managing.Application.ManageBot
{
var existingBot = await repo.GetBotByIdentifierAsync(bot.Identifier);
if (existingBot == null)
{
_tradingBotLogger.LogInformation("Creating new bot statistics for bot {BotId}",
bot.Identifier);
// Update existing bot
await _botRepository.UpdateBot(bot);
_tradingBotLogger.LogDebug(
"Updated bot statistics for bot {BotId}: Wins={Wins}, Losses={Losses}, PnL={PnL}, ROI={ROI}%, Volume={Volume}, Fees={Fees}",
bot.Identifier, bot.TradeWins, bot.TradeLosses, bot.Pnl, bot.Roi, bot.Volume, bot.Fees);
}
else
{
_tradingBotLogger.LogInformation("Updating existing bot statistics for bot {BotId}",
bot.Identifier);
@@ -320,6 +310,16 @@ namespace Managing.Application.ManageBot
"Created new bot statistics for bot {BotId}: Wins={Wins}, Losses={Losses}, PnL={PnL}, ROI={ROI}%, Volume={Volume}, Fees={Fees}",
bot.Identifier, bot.TradeWins, bot.TradeLosses, bot.Pnl, bot.Roi, bot.Volume, bot.Fees);
}
else
{
_tradingBotLogger.LogInformation("Creating new bot statistics for bot {BotId}",
bot.Identifier);
// Update existing bot
await _botRepository.UpdateBot(bot);
_tradingBotLogger.LogDebug(
"Updated bot statistics for bot {BotId}: Wins={Wins}, Losses={Losses}, PnL={PnL}, ROI={ROI}%, Volume={Volume}, Fees={Fees}",
bot.Identifier, bot.TradeWins, bot.TradeLosses, bot.Pnl, bot.Roi, bot.Volume, bot.Fees);
}
});
return true;