Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SW.Scheduler/QuartzSchedulerViewerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public async Task RescheduleAsync(string group, string name, string newCronExpre
var newTrigger = TriggerBuilder.Create()
.WithIdentity(existing.Key)
.ForJob(jobKey)
.WithCronSchedule(newCronExpression)
.WithCronSchedule(newCronExpression, b => b.InTimeZone(TimeZoneInfo.Utc))
.Build();

await scheduler.RescheduleJob(existing.Key, newTrigger, ct);
Expand Down
8 changes: 4 additions & 4 deletions SW.Scheduler/ScheduleRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static ITrigger RebuildCronTrigger(ITrigger existing, string newCronExpre
=> TriggerBuilder.Create()
.WithIdentity(existing.Key)
.ForJob(existing.JobKey)
.WithCronSchedule(newCronExpression, b => b.ApplyMisfire(misfire))
.WithCronSchedule(newCronExpression, b => b.ApplyMisfire(misfire).InTimeZone(TimeZoneInfo.Utc))
.UsingJobData(existing.JobDataMap)
.Build();
}
Expand Down Expand Up @@ -166,7 +166,7 @@ public async Task Schedule<TScheduler, TParam>(TParam param, string cronExpressi
var trigger = TriggerBuilder.Create()
.WithIdentity(triggerKey)
.ForJob(jobKey)
.WithCronSchedule(cronExpression, b => b.ApplyMisfire(config.MisfireInstructions))
.WithCronSchedule(cronExpression, b => b.ApplyMisfire(config.MisfireInstructions).InTimeZone(TimeZoneInfo.Utc))
.Build();

await scheduler.ScheduleJob(job, trigger);
Expand All @@ -192,7 +192,7 @@ public async Task Schedule<TScheduler>(string cronExpression, ScheduleConfig? co
var newTrigger = TriggerBuilder.Create()
.WithIdentity(triggerKeyObj)
.ForJob(jobKey)
.WithCronSchedule(cronExpression, b => b.ApplyMisfire(config.MisfireInstructions))
.WithCronSchedule(cronExpression, b => b.ApplyMisfire(config.MisfireInstructions).InTimeZone(TimeZoneInfo.Utc))
.Build();

// If the config (concurrency / recovery) has changed, update the stored durable job too.
Expand Down Expand Up @@ -417,7 +417,7 @@ public async Task<bool> ScheduleIfNotExists<TScheduler, TParam>(TParam param, st
var trigger = TriggerBuilder.Create()
.WithIdentity(triggerKey)
.ForJob(jobKey)
.WithCronSchedule(cronExpression, b => b.ApplyMisfire(config.MisfireInstructions))
.WithCronSchedule(cronExpression, b => b.ApplyMisfire(config.MisfireInstructions).InTimeZone(TimeZoneInfo.Utc))
.Build();

await scheduler.ScheduleJob(job, trigger);
Expand Down
4 changes: 2 additions & 2 deletions SW.Scheduler/SchedulerPreparation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private async Task RegisterJob(IScheduler scheduler, ScheduledJobDefinition jobD
.WithIdentity(triggerKey)
.ForJob(jobKey)
.WithCronSchedule(scheduleAttr.CronExpression,
b => b.ApplyMisfire(config.MisfireInstructions))
b => b.ApplyMisfire(config.MisfireInstructions).InTimeZone(TimeZoneInfo.Utc))
.WithDescription(scheduleAttr.Description)
.Build();

Expand Down Expand Up @@ -145,7 +145,7 @@ private async Task RegisterCleanupJob(IScheduler scheduler, SchedulerOptions opt
.WithIdentity(triggerKey)
.ForJob(jobKey)
.WithCronSchedule(options.CleanupCronExpression,
b => b.WithMisfireHandlingInstructionDoNothing())
b => b.WithMisfireHandlingInstructionDoNothing().InTimeZone(TimeZoneInfo.Utc))
.WithDescription($"Deletes JobExecution records older than {options.RetentionDays} days.")
.Build();

Expand Down
Loading