per_slot_settings(docs): per slot settings - the highest priority

This commit is contained in:
Georgiy Zatserklianyi 2023-02-16 14:52:31 +02:00
parent 474087be6f
commit 98a5958687
1 changed files with 6 additions and 6 deletions

View File

@ -102,13 +102,13 @@ class Downloader:
key = self._get_slot_key(request, spider)
if key not in self.slots:
slot_settings = self.per_slot_settings.get(key, {})
conc = slot_settings.get(
'concurrency', (
self.ip_concurrency if self.ip_concurrency else self.domain_concurrency
)
)
conc = (
self.ip_concurrency if self.ip_concurrency else self.domain_concurrency)
conc, delay = _get_concurrency_delay(conc, spider, self.settings)
delay = slot_settings.get('delay', delay)
conc, delay = (
slot_settings.get('concurrency', conc),
slot_settings.get('delay', delay)
)
randomize_delay = slot_settings.get('randomize_delay', self.randomize_delay)
new_slot = Slot(conc, delay, randomize_delay)
self.slots[key] = new_slot