mirror of https://github.com/scrapy/scrapy.git
move an object from signal to spider
This commit is contained in:
parent
0eb3e5246a
commit
53f81d0f80
|
|
@ -121,7 +121,7 @@ class ExecutionEngine(object):
|
|||
while not self._needs_backout(spider) and slot.start_requests:
|
||||
try:
|
||||
request = next(slot.start_requests)
|
||||
if request == signals.WaitUntilQueueEmpty:
|
||||
if request == spider.WaitUntilQueueEmpty:
|
||||
break
|
||||
self.crawl(request, spider)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,5 +26,3 @@ stats_spider_closed = spider_closed
|
|||
item_passed = item_scraped
|
||||
|
||||
request_received = request_scheduled
|
||||
|
||||
WaitUntilQueueEmpty = object()
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ from scrapy.utils.python import iflatten
|
|||
|
||||
|
||||
class Spider(object_ref):
|
||||
WaitUntilQueueEmpty = object()
|
||||
|
||||
"""Base class for scrapy spiders. All spiders must inherit from this
|
||||
class.
|
||||
"""
|
||||
|
|
@ -84,7 +86,7 @@ class Spider(object_ref):
|
|||
yield Request(url, dont_filter=True)
|
||||
|
||||
def start_requests_with_control(self):
|
||||
sig = signals.WaitUntilQueueEmpty
|
||||
sig = self.WaitUntilQueueEmpty
|
||||
gen_ = ((r, sig) if r != sig else (r,) for r in self.start_requests())
|
||||
return iflatten(gen_)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue