fix(spiders): handle errors with manual pause during stream mode
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user