@@ -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}
0 commit comments