Skip to content

Commit cd0f8a0

Browse files
committed
fix
1 parent bca682f commit cd0f8a0

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

src/ScheduledTasks/Client/ScheduledTaskClient.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ public async Task<IScheduleHandle> CreateScheduleAsync(ScheduleCreationOptions c
2727
string scheduleId = creationOptions.ScheduleId;
2828
EntityInstanceId entityId = new EntityInstanceId(nameof(Schedule), scheduleId);
2929

30-
// Check if schedule already exists
31-
bool scheduleExists = await this.CheckScheduleExists(scheduleId, cancellation);
32-
if (scheduleExists)
33-
{
34-
throw new ScheduleAlreadyExistException(scheduleId);
35-
}
36-
3730
// Call the orchestrator to create the schedule
3831
ScheduleOperationRequest request = new ScheduleOperationRequest(entityId, nameof(Schedule.CreateSchedule), creationOptions);
3932
string instanceId = await this.durableTaskClient.ScheduleNewOrchestrationInstanceAsync(
@@ -184,33 +177,4 @@ public AsyncPageable<ScheduleDescription> ListSchedulesAsync(ScheduleQuery? filt
184177
}
185178
});
186179
}
187-
188-
/// <summary>
189-
/// Checks if a schedule with the specified ID exists.
190-
/// </summary>
191-
/// <param name="scheduleId">The ID of the schedule to check.</param>
192-
/// <param name="cancellation">Optional cancellation token.</param>
193-
/// <returns>True if the schedule exists, false otherwise.</returns>
194-
async Task<bool> CheckScheduleExists(string scheduleId, CancellationToken cancellation = default)
195-
{
196-
Check.NotNullOrEmpty(scheduleId, nameof(scheduleId));
197-
198-
try
199-
{
200-
EntityInstanceId entityId = new EntityInstanceId(nameof(Schedule), scheduleId);
201-
EntityMetadata? metadata = await this.durableTaskClient.Entities.GetEntityAsync(entityId, false, cancellation);
202-
203-
return metadata != null;
204-
}
205-
catch (OperationCanceledException e)
206-
{
207-
this.logger.ClientError(
208-
nameof(this.CheckScheduleExists),
209-
scheduleId,
210-
e);
211-
212-
throw new OperationCanceledException(
213-
$"The {nameof(this.CheckScheduleExists)} operation was canceled.", e, e.CancellationToken);
214-
}
215-
}
216180
}

src/ScheduledTasks/Models/ScheduleCreationOptions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public ScheduleCreationOptions(string scheduleId, string orchestrationName, Time
6767
public TimeSpan Interval { get; }
6868

6969
/// <summary>
70-
/// Gets a value indicating whether to start the schedule immediately if it is late. Default is false.
70+
/// Gets a value indicating whether to start the orchestration immediately when the current time is past the StartAt time.
71+
/// By default it is false.
72+
/// If false, the first run will be scheduled at the next interval based on the original start time.
73+
/// If true, the first run will start immediately and subsequent runs will follow the regular interval.
7174
/// </summary>
7275
public bool StartImmediatelyIfLate { get; init; }
7376
}

0 commit comments

Comments
 (0)