I am using Scrapy framework for crawling some websites. I want to stop crawling immediately after a flag I decide. In my pipeline I stop the crawler like this:
spider.crawler.engine.close_spider(self, reason='My reason')
It stops when I want but it doesn't stop executing the code until it sends requests on the urls remaining in the connectionpool and I don't want that. How can I stop it immediately, is there a way to clear the urls from the connectionpool?
Thank you in advance.