@@ -226,6 +226,22 @@ async def create(
226226 await enqueue_schedule_event (self .app , schedule_id )
227227 return schedule_id
228228
229+ async def _set_unexpected_opration_state (
230+ self ,
231+ schedule_id : ScheduleId ,
232+ operation_error_type : OperationErrorType ,
233+ message : str ,
234+ ) -> None :
235+ schedule_data_proxy = ScheduleDataStoreProxy (
236+ store = self ._store , schedule_id = schedule_id
237+ )
238+ await schedule_data_proxy .set_multiple (
239+ {
240+ "operation_error_type" : operation_error_type ,
241+ "operation_error_message" : message ,
242+ }
243+ )
244+
229245 @asynccontextmanager
230246 async def _safe_event (self , schedule_id : ScheduleId ) -> AsyncIterator [None ]:
231247 try :
@@ -430,6 +446,7 @@ async def _continue_as_repeating_steps(
430446 await enqueue_schedule_event (self .app , schedule_id )
431447 return
432448
449+ # restaret steps in group
433450 await limited_gather (
434451 * (x .remove () for x in step_proxies ),
435452 limit = _PARALLEL_STATUS_REQUESTS ,
@@ -612,22 +629,6 @@ async def _continue_handling_as_reverting(
612629 direction = "revert" , steps_statuses = steps_statuses , schedule_id = schedule_id
613630 )
614631
615- async def _set_unexpected_opration_state (
616- self ,
617- schedule_id : ScheduleId ,
618- operation_error_type : OperationErrorType ,
619- message : str ,
620- ) -> None :
621- schedule_data_proxy = ScheduleDataStoreProxy (
622- store = self ._store , schedule_id = schedule_id
623- )
624- await schedule_data_proxy .set_multiple (
625- {
626- "operation_error_type" : operation_error_type ,
627- "operation_error_message" : message ,
628- }
629- )
630-
631632
632633async def lifespan (app : FastAPI ) -> AsyncIterator [State ]:
633634 app .state .generic_scheduler_core = Core (app )
@@ -649,6 +650,3 @@ async def start_operation(
649650
650651async def cancel_operation (app : FastAPI , schedule_id : ScheduleId ) -> None :
651652 await get_core (app ).cancel_schedule (schedule_id )
652-
653-
654- # TODO: refeactor this module to make the code more redable
0 commit comments