From 3fbbca223ea370feb62835763c1cca1d005b00fe Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Wed, 12 Aug 2026 01:13:55 +0900 Subject: [PATCH] fix: Add HistoricalBatchShadowRunJob to DI and fix ExecuteAsync signature - Register HistoricalBatchShadowRunJob in services (line 106) - Simplified ExecuteAsync to take only CancellationToken (Hangfire lambda requirement) - Set targetModelId to Guid.Empty for batch processing Co-Authored-By: Claude Haiku 4.5 --- src/KArtSell.Host/Jobs/HistoricalBatchShadowRunJob.cs | 6 +++--- src/KArtSell.Host/Program.cs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/KArtSell.Host/Jobs/HistoricalBatchShadowRunJob.cs b/src/KArtSell.Host/Jobs/HistoricalBatchShadowRunJob.cs index 8c13a1bc..f6054438 100644 --- a/src/KArtSell.Host/Jobs/HistoricalBatchShadowRunJob.cs +++ b/src/KArtSell.Host/Jobs/HistoricalBatchShadowRunJob.cs @@ -36,10 +36,10 @@ public sealed class HistoricalBatchShadowRunJob( /// [Queue("q-research")] [DisableConcurrentExecution(timeoutInSeconds: 300)] // 5 min to queue; job itself has 30 min - public async Task ExecuteAsync(Guid? modelId = null, CancellationToken cancellationToken = default) + public async Task ExecuteAsync(CancellationToken cancellationToken = default) { - // Use provided modelId or default to all-models sentinel - var targetModelId = modelId ?? Guid.Empty; + // Use all-models sentinel for batch + var targetModelId = Guid.Empty; // Calculate 1-year window: 252 trading days ≈ 365 calendar days var endDate = DateOnly.FromDateTime(clock.UtcNow.Date); diff --git a/src/KArtSell.Host/Program.cs b/src/KArtSell.Host/Program.cs index e1a1a190..bdc85d5e 100644 --- a/src/KArtSell.Host/Program.cs +++ b/src/KArtSell.Host/Program.cs @@ -103,6 +103,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); // OpenDart Services builder.Services.AddScoped(); @@ -395,7 +396,7 @@ else // Register other Hangfire jobs var kstTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Asia/Seoul"); -try { RecurringJob.AddOrUpdate("historical-batch-shadow-run", job => job.ExecuteAsync(null, CancellationToken.None), "0 21 * * *", new RecurringJobOptions { TimeZone = kstTimeZone }); logger.LogInformation("✅ historical-batch-shadow-run registered (daily 21:00 KST)"); } catch (Exception ex) { logger.LogWarning(ex, "⚠️ historical-batch-shadow-run error"); } +try { RecurringJob.AddOrUpdate("historical-batch-shadow-run", job => job.ExecuteAsync(CancellationToken.None), "0 21 * * *", new RecurringJobOptions { TimeZone = kstTimeZone }); logger.LogInformation("✅ historical-batch-shadow-run registered (daily 21:00 KST)"); } catch (Exception ex) { logger.LogWarning(ex, "⚠️ historical-batch-shadow-run error"); } try { RecurringJob.AddOrUpdate("opendart-daily-batch", job => job.ExecuteAsync(CancellationToken.None), "0 9 * * *", new RecurringJobOptions { TimeZone = kstTimeZone }); logger.LogInformation("✅ opendart-daily-batch registered"); } catch (Exception ex) { logger.LogWarning(ex, "⚠️ opendart-daily-batch error"); } try { RecurringJob.AddOrUpdate("daily-recommendation", job => job.ExecuteAsync(CancellationToken.None), "0 9 * * *", new RecurringJobOptions { TimeZone = kstTimeZone }); logger.LogInformation("✅ daily-recommendation registered"); } catch (Exception ex) { logger.LogWarning(ex, "⚠️ daily-recommendation error"); } try { RecurringJob.AddOrUpdate("weekly-recommendation", job => job.ExecuteAsync(CancellationToken.None), "0 9 * * 6", new RecurringJobOptions { TimeZone = kstTimeZone }); logger.LogInformation("✅ weekly-recommendation registered"); } catch (Exception ex) { logger.LogWarning(ex, "⚠️ weekly-recommendation error"); }