@@ -174,7 +174,7 @@ def build_retry_error(
174174def _retry_error_helper (
175175 exc : Exception ,
176176 deadline : float | None ,
177- sleep_generator : Iterator [float ],
177+ sleep_iterator : Iterator [float ],
178178 error_list : list [Exception ],
179179 predicate_fn : Callable [[Exception ], bool ],
180180 on_error_fn : Callable [[Exception ], None ] | None ,
@@ -194,7 +194,7 @@ def _retry_error_helper(
194194 Args:
195195 - exc: the exception that was raised
196196 - deadline: the deadline for the retry, calculated as a diff from time.monotonic()
197- - sleep_generator: iterable to draw the next backoff value from
197+ - sleep_iterator: iterator to draw the next backoff value from
198198 - error_list: the list of exceptions that have been raised so far
199199 - predicate_fn: takes `exc` and returns true if the operation should be retried
200200 - on_error_fn: callback to execute when a retryable error occurs
@@ -214,10 +214,10 @@ def _retry_error_helper(
214214 raise final_exc from source_exc
215215 if on_error_fn is not None :
216216 on_error_fn (exc )
217- # next_sleep is fetched after the on_error callback to allow clients
218- # to update sleep_generator values dynamically in response to errors
217+ # next_sleep is fetched after the on_error callback, to allow clients
218+ # to update sleep_iterator values dynamically in response to errors
219219 try :
220- next_sleep = next (sleep_generator )
220+ next_sleep = next (sleep_iterator )
221221 except StopIteration :
222222 raise ValueError ("Sleep generator stopped yielding sleep values." ) from exc
223223 if deadline is not None and time .monotonic () + next_sleep > deadline :
0 commit comments