refactor(dotnet): externalize scheduler definitions
Validators (Pushes and Pull Requests) / validate-ui-and-storage (push) Successful in 16s
Validators (Pushes and Pull Requests) / validate-core (push) Has been cancelled

This commit is contained in:
2026-07-13 00:39:59 +09:00
parent 3fbb5ea2bf
commit c852ad49cf
4 changed files with 24 additions and 10 deletions
@@ -9,6 +9,7 @@ using QuantEngine.Application.Services;
using QuantEngine.Application.Interfaces;
using QuantEngine.Infrastructure.Data;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
namespace QuantEngine.Web.Services;
@@ -23,6 +24,7 @@ public class SchedulerService
private readonly IServiceScopeFactory _scopeFactory;
private readonly IConfiguration _configuration;
private readonly GatherTradingDataParser _parser;
private readonly SchedulerServiceOptions _options;
private readonly string _auditRoot;
public SchedulerService(
@@ -31,7 +33,8 @@ public class SchedulerService
IRecurringJobManager recurringJobManager,
IServiceScopeFactory scopeFactory,
IConfiguration configuration,
GatherTradingDataParser parser)
GatherTradingDataParser parser,
IOptions<SchedulerServiceOptions> options)
{
_logger = logger;
_jobClient = jobClient;
@@ -39,6 +42,7 @@ public class SchedulerService
_scopeFactory = scopeFactory;
_configuration = configuration;
_parser = parser;
_options = options.Value ?? new SchedulerServiceOptions();
_auditRoot = FindRepoTempRoot();
}
@@ -127,13 +131,8 @@ public class SchedulerService
}
}
public IReadOnlyList<SchedulerJobDefinition> GetRecurringJobDefinitions() => new[]
{
new SchedulerJobDefinition("daily-collection", "0 9 * * *", "Daily data collection", true),
new SchedulerJobDefinition("hourly-price-update", "0 9,11,13,15 * * 1-5", "Hourly price update", true),
new SchedulerJobDefinition("weekly-report", "0 17 * * 5", "Weekly report generation", true),
new SchedulerJobDefinition("monthly-optimization", "0 2 1 * *", "Monthly optimization", true),
};
public IReadOnlyList<SchedulerJobDefinition> GetRecurringJobDefinitions()
=> _options.JobDefinitions.Count > 0 ? _options.JobDefinitions : new SchedulerServiceOptions().JobDefinitions;
private static string? FindGatherTradingDataJson()
{