@@ -123,17 +123,17 @@ def __init__(
123123
124124 self .persistence_store = persistence_store
125125
126- def handle (self , durable_mode : str | None = None ) -> Any :
126+ def handle (self , is_replay : bool = False ) -> Any :
127127 """
128128 Main entry point for handling idempotent execution of a function.
129129
130130 Parameters
131131 ----------
132- durable_mode : str | None , optional
133- Mode for handling in-progress executions. Options:
134- - "REPLAY_MODE": Allow replay of functions that are already in progress
135- - "EXECUTION_MODE": Standard durable execution mode
136- - None: Standard idempotency behavior (raises IdempotencyAlreadyInProgressError)
132+ is_replay : bool , optional
133+ Whether this is a replay of a function that is already in progress.
134+ If True, allows replay of functions that are already in progress.
135+ If False, uses standard idempotency behavior (raises IdempotencyAlreadyInProgressError).
136+ Defaults to False.
137137
138138 Returns
139139 -------
@@ -146,12 +146,12 @@ def handle(self, durable_mode: str | None = None) -> Any:
146146 # In most cases we can retry successfully on this exception.
147147 for i in range (MAX_RETRIES + 1 ): # pragma: no cover
148148 try :
149- return self ._process_idempotency (durable_mode )
149+ return self ._process_idempotency (is_replay )
150150 except IdempotencyInconsistentStateError :
151151 if i == MAX_RETRIES :
152152 raise # Bubble up when exceeded max tries
153153
154- def _process_idempotency (self , durable_mode : str | None ):
154+ def _process_idempotency (self , is_replay : bool ):
155155 try :
156156 # We call save_inprogress first as an optimization for the most common case where no idempotent record
157157 # already exists. If it succeeds, there's no need to call get_record.
@@ -167,7 +167,7 @@ def _process_idempotency(self, durable_mode: str | None):
167167 # We give preference to ReturnValuesOnConditionCheckFailure because it is a faster and more cost-effective
168168 # way of retrieving the existing record after a failed conditional write operation.
169169 record = exc .old_data_record or self ._get_idempotency_record ()
170- if durable_mode == "REPLAY_MODE" :
170+ if is_replay :
171171 return self ._get_function_response ()
172172 # If a record is found, handle it for status
173173 if record :
0 commit comments