Expose bounded seed progress for long reconciler experiments

This commit is contained in:
Artyom
2026-11-06 02:32:19 +03:00
parent 827b783be3
commit 3402fd69d4
3 changed files with 10 additions and 1 deletions
+5
View File
@@ -65,6 +65,7 @@ async def seed(count: int, concurrency: int) -> dict[str, object]:
raise SystemExit("нет ни одного чата: сначала make test")
ids = [uuid4() for _ in range(count)]
pending = iter(ids)
completed = 0
started = time.monotonic()
async with s3_client(
endpoint=settings.s3_endpoint,
@@ -78,8 +79,12 @@ async def seed(count: int, concurrency: int) -> dict[str, object]:
storage = S3ObjectStorage(client, settings.s3_bucket)
async def worker() -> None:
nonlocal completed
for attachment_id in pending:
await storage.put(f"attachments/{attachment_id}", body, "image/png")
completed += 1
if completed % 10000 == 0 or completed == count:
print(json.dumps({"progress": completed, "target": count}), flush=True)
await asyncio.gather(*(worker() for _ in range(concurrency)))
stored = time.monotonic()