rmax / scrapy-redis

Redis-based components for Scrapy.
http://scrapy-redis.readthedocs.io
MIT License
5.54k stars 1.59k forks source link

[spiders] Remove duplicate check setting types #261

Closed LuckyPigeon closed 2 years ago

LuckyPigeon commented 2 years ago

Description

When a spider get parameter from settings, there's a duplicate type checking show as follow.

if self.redis_batch_size is None:
  self.redis_batch_size = settings.getint('CONCURRENT_REQUESTS', defaults.REDIS_CONCURRENT_REQUESTS)
try:
  self.redis_batch_size = int(self.redis_batch_size)
except (TypeError, ValueError):
  raise ValueError("redis_batch_size must be an integer")

Fixes #260

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Test Configuration:

Checklist: