From 5b1f62cece2184f9e0cccb5a59d8745f9d0d56cd Mon Sep 17 00:00:00 2001 From: extreme4all <> Date: Mon, 27 May 2024 22:37:20 +0200 Subject: [PATCH] increase insert interval --- src/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 0872b74..80a8026 100644 --- a/src/main.py +++ b/src/main.py @@ -66,13 +66,15 @@ async def queue_to_batch(queue: Queue, max_len: int = None) -> list: async def insert_batch(valid_report_queue: Queue): + INSERT_INTERVAL_SEC = 20 last_time = time.time() + batch = [] while True: if valid_report_queue.empty(): await asyncio.sleep(1) continue - if time.time() - last_time < 10: + if time.time() - last_time < INSERT_INTERVAL_SEC or batch > 10_000: await asyncio.sleep(1) continue