Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Check pending start_requests before calling _spider_idle() in engine (fixes #706)

Paul Tremberth7199555e1a49
diff --git a/scrapy/core/engine.py b/scrapy/core/engine.py
index 8a307a29e..1da2dba03 100644
--- a/scrapy/core/engine.py
+++ b/scrapy/core/engine.py
@@ -112,6 +112,7 @@ class ExecutionEngine(object):
except StopIteration:
slot.start_requests = None
except Exception as exc:
+ slot.start_requests = None
log.err(None, 'Obtaining request from start requests', \
spider=spider)
else:
@@ -156,7 +157,8 @@ class ExecutionEngine(object):
scraper_idle = self.scraper.slot.is_idle()
pending = self.slot.scheduler.has_pending_requests()
downloading = bool(self.downloader.active)
- idle = scraper_idle and not (pending or downloading)
+ pending_start_requests = self.slot.start_requests is not None
+ idle = scraper_idle and not (pending or downloading or pending_start_requests)
return idle
@property