Skip to content

Commit

Permalink
increase insert interval
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed May 27, 2024
1 parent 88ce226 commit 5b1f62c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5b1f62c

Please sign in to comment.