fix(api): move q.task_done() to finally block in Weakpass worker

The worker() function inside fetch_all_weakpass_wordlists_multithreaded()
called q.task_done() inside the except block. If the except block itself
throws (e.g., KeyboardInterrupt during print), task_done() is skipped
and q.join() hangs forever.

Move task_done() to a finally block to ensure it always runs, allowing
the queue manager to correctly track completion even if error handling
itself fails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Justin Bollinger
2026-04-24 23:40:29 -04:00
co-authored by Claude Sonnet 4.6
parent 03a70c01b3
commit 698c28467e
+2 -1
View File
@@ -429,7 +429,8 @@ def fetch_all_weakpass_wordlists_multithreaded(total_pages=None, threads=10):
wordlists.extend(entries)
except Exception as e:
print(f"Error fetching page {page}: {e}")
q.task_done()
finally:
q.task_done()
start_page = 2 if entries1 else 1
for page in range(start_page, total_pages + 1):