mirror of https://github.com/scrapy/scrapy.git
Set CONCURRENT_SPIDERS=1 in Scrapyd to force one spider per process
This commit is contained in:
parent
b1c89508f5
commit
65fc2fbd1f
|
|
@ -30,6 +30,7 @@ class Environment(object):
|
|||
dbpath = os.path.join(self.dbs_dir, '%s.db' % project)
|
||||
env['SCRAPY_SQLITE_DB'] = dbpath
|
||||
env['SCRAPY_LOG_FILE'] = self._get_log_file(message)
|
||||
env['SCRAPY_CONCURRENT_SPIDERS'] = '1' # scrapyd runs one spider per process
|
||||
return env
|
||||
|
||||
def _get_log_file(self, message):
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class EnvironmentTest(unittest.TestCase):
|
|||
self.assertEqual(env['SCRAPY_SLOT'], '3')
|
||||
self.assertEqual(env['SCRAPY_SPIDER'], 'myspider')
|
||||
self.assertEqual(env['SCRAPY_JOB'], 'ID')
|
||||
self.assertEqual(env['SCRAPY_CONCURRENT_SPIDERS'], '1')
|
||||
self.assert_(env['SCRAPY_SQLITE_DB'].endswith('mybot.db'))
|
||||
self.assert_(env['SCRAPY_LOG_FILE'].endswith('/mybot/myspider/ID.log'))
|
||||
self.failIf('SCRAPY_SETTINGS_MODULE' in env)
|
||||
|
|
|
|||
Loading…
Reference in New Issue