Keep asyncio sleep
This commit is contained in:
parent
7707b818f0
commit
b70f55c9cc
@ -1,7 +1,7 @@
|
|||||||
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
from asyncio.exceptions import TimeoutError
|
from asyncio.exceptions import TimeoutError
|
||||||
from time import sleep
|
|
||||||
from typing import Any, Callable, Collection, Coroutine, Type
|
from typing import Any, Callable, Collection, Coroutine, Type
|
||||||
|
|
||||||
from aiohttp.client_exceptions import (
|
from aiohttp.client_exceptions import (
|
||||||
@ -67,9 +67,7 @@ async def exception_retry_with_backoff_middleware(
|
|||||||
backoff_time = backoff_time_seconds * (
|
backoff_time = backoff_time_seconds * (
|
||||||
random.uniform(5, 10) ** i
|
random.uniform(5, 10) ** i
|
||||||
)
|
)
|
||||||
# use blocking sleep to prevent new tries on
|
await asyncio.sleep(backoff_time)
|
||||||
# concurrent requests during sleep
|
|
||||||
sleep(backoff_time)
|
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user