Skip to content

Commit 7dfaf1a

Browse files
vdusekclaude
andauthored
fix(scrapy): Close AsyncThread on scheduler open() failure (#820)
## Summary - Close `AsyncThread` in the `except` block of `ApifyScheduler.open()` before re-raising, preventing a thread leak when `open_rq()` fails (Scrapy only calls `close()` after a successful `open()`). Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 75e4c04 commit 7dfaf1a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/apify/scrapy/scheduler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ async def open_rq() -> RequestQueue:
6161
try:
6262
self._rq = self._async_thread.run_coro(open_rq())
6363
except Exception:
64+
self._async_thread.close()
6465
traceback.print_exc()
6566
raise
6667

0 commit comments

Comments
 (0)