fix(spiders): handle errors with manual pause during stream mode

This commit is contained in:
Karim shoair
2026-01-19 16:13:03 +02:00
parent fbc8be5bcc
commit 25850db92c
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -207,6 +207,7 @@ class CrawlerEngine:
self._items.clear()
self.paused = False
self._pause_requested = False
self._force_stop = False
self.stats = CrawlStats(start_time=anyio.current_time())
# Check for existing checkpoint
+3 -1
View File
@@ -211,7 +211,9 @@ class Spider(ABC):
manager.add("default", FetcherSession())
def pause(self):
"""Pause the crawling process if checkpoint system is enabled."""
"""Pause the crawling process. Requires crawldir to be set for checkpoint system."""
if not self.crawldir:
raise RuntimeError("Cannot pause without crawldir - checkpoint system not enabled")
if self._engine:
self._engine.request_pause()
else: