Fix backtest count
This commit is contained in:
@@ -122,6 +122,7 @@ public class BacktestComputeWorker : BackgroundService
|
||||
var executor = scope.ServiceProvider.GetRequiredService<BacktestExecutor>();
|
||||
var userService = scope.ServiceProvider.GetRequiredService<IUserService>();
|
||||
var exchangeService = scope.ServiceProvider.GetRequiredService<IExchangeService>();
|
||||
var agentSummaryRepository = scope.ServiceProvider.GetRequiredService<IAgentSummaryRepository>();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -192,6 +193,18 @@ public class BacktestComputeWorker : BackgroundService
|
||||
|
||||
await jobRepository.UpdateAsync(job);
|
||||
|
||||
// Increment backtest count for the user's agent summary
|
||||
try
|
||||
{
|
||||
await agentSummaryRepository.IncrementBacktestCountAsync(job.UserId);
|
||||
_logger.LogDebug("Incremented backtest count for user {UserId}", job.UserId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to increment backtest count for user {UserId}", job.UserId);
|
||||
// Don't fail the job if this update fails
|
||||
}
|
||||
|
||||
_logger.LogInformation(
|
||||
"Completed backtest job {JobId}. Score: {Score}, PnL: {PnL}",
|
||||
job.Id, result.Score, result.FinalPnl);
|
||||
|
||||
Reference in New Issue
Block a user