Skip to content

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

CloseDomain extension: fixed bug on domain close when not using CLOSEDOMAIN_TIMEOUT

Pablo Hoffman64d91555729d
diff --git a/scrapy/contrib/closedomain.py b/scrapy/contrib/closedomain.py
index c5d767338..74f9b4ca1 100644
--- a/scrapy/contrib/closedomain.py
+++ b/scrapy/contrib/closedomain.py
@@ -39,6 +39,6 @@ class CloseDomain(object):
def domain_closed(self, domain):
self.counts.pop(domain, None)
- tsk = self.tasks.pop(domain)
- if not tsk.called:
+ tsk = self.tasks.pop(domain, None)
+ if tsk and not tsk.called:
tsk.cancel()