| 1234567891011121314151617181920 |
- using Admin.NET.Plugin.AiDOP.DataPlatform.UnifiedIngress;
- using Furion.Schedule;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Logging;
- namespace Admin.NET.Plugin.AiDOP.Job;
- [JobDetail("job_mdp_api_pull", Description = "数据中台 API 拉取", GroupName = "default", Concurrent = false)]
- [PeriodSeconds(15, TriggerId = "trigger_mdp_api_pull", Description = "续接已启用的 API 拉取任务", RunOnStart = false)]
- public sealed class MdpApiPullScheduleJob(IServiceScopeFactory scopes, IConfiguration config, ILogger<MdpApiPullScheduleJob> logger) : IJob
- {
- public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
- {
- if (!AidopJobGate.ShouldRun(nameof(MdpApiPullScheduleJob), logger)
- || !config.GetValue<bool>("MdpApiPull:ScheduleEnabled")) return;
- using var scope = scopes.CreateScope();
- await scope.ServiceProvider.GetRequiredService<MdpApiPullService>().RunScheduledAsync(stoppingToken);
- }
- }
|