Skip to content

Commit ae649c9

Browse files
committed
createorupdate
1 parent cd0f8a0 commit ae649c9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/ScheduledTasks/Entity/Schedule.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Schedule(ILogger<Schedule> logger) : TaskEntity<ScheduleState>
2020
readonly ILogger<Schedule> logger = logger ?? throw new ArgumentNullException(nameof(logger));
2121

2222
/// <summary>
23-
/// Creates a new schedule with the specified configuration.
23+
/// Creates a new schedule with the specified configuration. If already exists, update it in place.
2424
/// </summary>
2525
/// <param name="context">The task entity context.</param>
2626
/// <param name="scheduleCreationOptions">The configuration options for creating the schedule.</param>
@@ -43,6 +43,7 @@ public void CreateSchedule(TaskEntityContext context, ScheduleCreationOptions sc
4343
this.State.ScheduleConfiguration = ScheduleConfiguration.FromCreateOptions(scheduleCreationOptions);
4444
this.TryStatusTransition(nameof(this.CreateSchedule), ScheduleStatus.Active);
4545

46+
this.State.RefreshScheduleRunExecutionToken();
4647
this.logger.CreatedSchedule(this.State.ScheduleConfiguration.ScheduleId);
4748

4849
// Signal to run schedule immediately after creation and let runSchedule determine if it should run immediately

src/ScheduledTasks/Models/ScheduleTransitions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ static class ScheduleTransitions
1313
new Dictionary<ScheduleStatus, HashSet<ScheduleStatus>>
1414
{
1515
{ ScheduleStatus.Uninitialized, new HashSet<ScheduleStatus> { ScheduleStatus.Active } },
16+
{ ScheduleStatus.Active, new HashSet<ScheduleStatus> { ScheduleStatus.Active } },
17+
{ ScheduleStatus.Paused, new HashSet<ScheduleStatus> { ScheduleStatus.Active } },
1618
};
1719

1820
// define valid transitions for update schedule

0 commit comments

Comments
 (0)