Skip to content

Commit

Permalink
fine tune batch insert
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed Feb 6, 2024
1 parent ee4d85d commit e6afa54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async def process_data(receive_queue: Queue, error_queue: Queue):
start_time=start_time,
_queue=receive_queue,
topic="scraper",
interval=15
)

# Check if queue is empty
Expand All @@ -161,7 +162,7 @@ async def process_data(receive_queue: Queue, error_queue: Queue):

now = time.time()

if len(batch) > 100 or now-start_time > 5:
if len(batch) > 100 or now-start_time > 15:
await insert_data(batch=batch, error_queue=error_queue)
batch = []

Expand Down

0 comments on commit e6afa54

Please sign in to comment.