mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 06:52:59 +00:00
Update utils.py
Prevent exponential_backoff() to crash with an Vverflow Error
This commit is contained in:
@@ -171,7 +171,15 @@ async def exponential_backoff(
|
|||||||
# add some random jitter to improve performance
|
# add some random jitter to improve performance
|
||||||
# this prevents overloading any single tornado loop iteration with
|
# this prevents overloading any single tornado loop iteration with
|
||||||
# too many things
|
# too many things
|
||||||
|
# Except Overflow Error. Otherwise start_wait * scale will be too big at some point.
|
||||||
|
try:
|
||||||
|
if scale == 0:
|
||||||
|
dt = min(max_wait, remaining))
|
||||||
|
else:
|
||||||
dt = min(max_wait, remaining, random.uniform(0, start_wait * scale))
|
dt = min(max_wait, remaining, random.uniform(0, start_wait * scale))
|
||||||
|
except OverflowError:
|
||||||
|
scale = 0
|
||||||
|
dt = min(max_wait, remaining)
|
||||||
scale *= scale_factor
|
scale *= scale_factor
|
||||||
await gen.sleep(dt)
|
await gen.sleep(dt)
|
||||||
raise TimeoutError(fail_message)
|
raise TimeoutError(fail_message)
|
||||||
|
Reference in New Issue
Block a user