Skip to content

Commit 9d206fa

Browse files
committed
Custom wait strategy
1 parent efba077 commit 9d206fa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ghga_service_commons/transports/ratelimiting.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ async def handle_async_request(self, request: httpx.Request) -> httpx.Response:
5454
# Caculate seconds since the last request has been fired and corresponding wait time
5555
time_elapsed = (self._last_request_time - datetime.now(timezone.utc)).seconds
5656
remaining_wait = max(0, self._wait_time - time_elapsed)
57+
log.info(
58+
"Time elapsed since last request:%.3f.\nWaiting for at least %.3f s",
59+
time_elapsed,
60+
remaining_wait,
61+
)
5762

5863
# Add jitter to both cases and sleep
5964
if remaining_wait < self._jitter:

0 commit comments

Comments
 (0)