Skip to content

Commit 6392549

Browse files
committed
Jitter once again
1 parent 5143662 commit 6392549

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ no_site_packages = false
149149
[tool.pytest.ini_options]
150150
minversion = "8.0"
151151
asyncio_mode = "strict"
152-
log_cli_level = "DEBUG"
153152

154153
[tool.coverage.paths]
155154
source = [

src/ghga_connector/core/downloading/downloader.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import base64
2020
import gc
2121
import logging
22+
import random
2223
import time
2324
from asyncio import PriorityQueue, Queue, Semaphore, Task, create_task
2425
from collections.abc import Coroutine
@@ -288,6 +289,10 @@ async def download_to_queue(self, *, part_range: PartRange) -> None:
288289
"""
289290
# Guard with semaphore to ensure only a set amount of downloads runs in parallel
290291
async with self._semaphore:
292+
# add some jitter
293+
wait_time = random.randint(20, 500) / 1000 # noqa: S311
294+
await asyncio.sleep(wait_time)
295+
291296
url_and_headers = await self.fetch_download_url()
292297
url = url_and_headers.download_url
293298
range_hash = (

0 commit comments

Comments
 (0)