Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

periodic_log: interval check moved

Georgiy Zatserklianyif05657e54245
diff --git a/scrapy/extensions/periodic_log.py b/scrapy/extensions/periodic_log.py
index 1023b3cd5..214f55777 100644
--- a/scrapy/extensions/periodic_log.py
+++ b/scrapy/extensions/periodic_log.py
@@ -37,6 +37,8 @@ class PeriodicLog:
@classmethod
def from_crawler(cls, crawler):
interval = crawler.settings.getfloat("LOGSTATS_INTERVAL")
+ if not interval:
+ raise NotConfigured
try:
ext_stats = crawler.settings.getdict("PERIODIC_LOG_STATS")
except (TypeError, ValueError):
@@ -57,8 +59,6 @@ class PeriodicLog:
ext_timing_enabled = crawler.settings.getbool(
"PERIODIC_LOG_TIMING_ENABLED", False
)
- if not interval:
- raise NotConfigured
if not (ext_stats or ext_delta or ext_timing_enabled):
raise NotConfigured
o = cls(