Fix concurrency
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user