mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 02:03:41 +00:00
minor code rearrangement for consistency
This commit is contained in:
parent
dd020e184f
commit
cb9c937f50
@ -57,7 +57,6 @@ class Downloader(object):
|
||||
self.slots = {}
|
||||
self.handlers = DownloadHandlers()
|
||||
self.middleware = DownloaderMiddlewareManager.from_settings(settings)
|
||||
self.concurrent_spiders = settings.getint('CONCURRENT_SPIDERS')
|
||||
|
||||
def fetch(self, request, spider):
|
||||
slot = self.slots[spider]
|
||||
|
@ -59,6 +59,7 @@ class ExecutionEngine(object):
|
||||
self.scheduler = load_object(settings['SCHEDULER'])()
|
||||
self.downloader = Downloader()
|
||||
self.scraper = Scraper(self, self.settings)
|
||||
self._concurrent_spiders = settings.getint('CONCURRENT_SPIDERS')
|
||||
self._spider_closed_callback = spider_closed_callback
|
||||
|
||||
@defer.inlineCallbacks
|
||||
@ -164,7 +165,7 @@ class ExecutionEngine(object):
|
||||
|
||||
def has_capacity(self):
|
||||
"""Does the engine have capacity to handle more spiders"""
|
||||
return len(self.downloader.slots) < self.downloader.concurrent_spiders
|
||||
return len(self.slots) < self._concurrent_spiders
|
||||
|
||||
def crawl(self, request, spider):
|
||||
assert spider in self.open_spiders, \
|
||||
|
Loading…
x
Reference in New Issue
Block a user