Skip to content

Commit 7113598

Browse files
vdusekclaude
andcommitted
fix(scrapy): Close AsyncThread on scheduler open() failure
If `open_rq()` raises, Scrapy will not call `close()`, so the `AsyncThread` (and its event loop thread) would leak. Close it explicitly before re-raising. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 69b8af9 commit 7113598

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)