dotnet-labs / ServiceWorkerCronJob

Schedule Cron Jobs using HostedService in ASP.NET Core
MIT License
265 stars 71 forks source link

Cronjob running after cronexpression #10

Closed kevinvenclovas closed 2 years ago

kevinvenclovas commented 2 years ago

Hello, i added a new Cronjob running every 10 minutes between 4 and 23 o'clock. When the job is running on 23:00:00 O'clock then the function GetNextOccurrence returned 23:10:00 but why? My cronjob sould only run from 4 - 23 o'clock.

service.AddCronJob<GDIEMailEventsCronjob>(c =>
{
      c.CronExpression = @"*/10 * 4-23 * *";
      c.CronJobType = CronJobType.GDI_EMAIL_EVENT;
});
public DateTime GetNextRunningTime(DateTime startTime)
{
  return schedule.GetNextOccurrence(startTime);
}

image

kevinvenclovas commented 2 years ago

Sorry my expression was wrong :/ -> /10 4-23