Skip to content

Commit 51cc78a

Browse files
committed
save
1 parent 556e8f4 commit 51cc78a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ScheduledTasks/Entity/Schedule.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ public void RunSchedule(TaskEntityContext context, string executionToken)
322322
throw exception;
323323
}
324324

325+
// if endat is set and time now is past endat, do not run
326+
if (scheduleConfig.EndAt.HasValue && DateTimeOffset.UtcNow > scheduleConfig.EndAt.Value)
327+
{
328+
this.logger.ScheduleRunCancelled(scheduleConfig.ScheduleId, executionToken);
329+
this.State.NextRunAt = null;
330+
return;
331+
}
332+
325333
// run schedule based on next run at
326334
// need to enforce the constraint here NextRunAt truly represents the next run at
327335
// if next run at is null, this means schedule is changed, we compute the next run at based on startat and update

0 commit comments

Comments
 (0)