Skip to content

Commit

Permalink
skip dupe check
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed Jul 13, 2024
1 parent ec32915 commit 3c29b69
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class ReportedDoesNotExist(PlayerDoesNotExist):
...


async def check_duplicate_report(report_queue: Queue, valid_report_queue: Queue):
async def check_duplicate_report(
report_queue: Queue,
valid_report_queue: Queue,
skip: bool = False,
):
while True:
# Check if both queues are empty
if report_queue.empty():
Expand All @@ -44,6 +48,10 @@ async def check_duplicate_report(report_queue: Queue, valid_report_queue: Queue)
msg: StgReportCreate = await report_queue.get()
report_queue.task_done()

if skip:
await valid_report_queue.put(msg)
continue

try:
# Acquire an asynchronous database session
session: AsyncSession = await get_session()
Expand Down Expand Up @@ -230,6 +238,7 @@ async def main():
check_duplicate_report(
report_queue=report_queue,
valid_report_queue=valid_report_queue,
skip=True,
)
)
asyncio.create_task(insert_batch(valid_report_queue=valid_report_queue))
Expand Down

0 comments on commit 3c29b69

Please sign in to comment.