ISchedulerConfiguration Cron hour doesnt work

  Kiến thức lập trình

I currently have a C# worker console project to which I have to assign to several threads the facility to run at specific times. With IScheduledEventConfiguration and the Cron() method I have used the expression * 13 * * * * which according to crontab.guru should run my process every 1 minute as long as it is 13 hours of the day, but it does not run at all; but if I put * * * * * * * * it works perfectly every minute.

this my code in Program.cs

 host.Services.UseScheduler(
     scheduler =>
foreach (var worker in workers)
{
    if (!(worker.Enabled ?? false)) continue;
    scheduler.OnWorker(worker.Name);
    IScheduleInterval schedulerSyncService;

    switch (worker.Profile!.ParseMode)
    {
        default:
            SyncEmpWorker.AddIsActive(worker.Name!);
            schedulerSyncService = scheduler.ScheduleWithParams<SyncEmpWorker>(worker);
            break;
    }

    var schedule = ScheduleManager.ScheduleFormat(worker.Schedule ?? string.Empty);
    var _schedulerSyncService =
        schedulerSyncService.Cron(schedule);
    if (worker.RunOnceAtStart ?? false)
        _schedulerSyncService.RunOnceAtStart();
}

I have tried using several expressions and looking for other methods including installing several nugets to solve the problem, but the time still does not work.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT