-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install the reactor after reading spider settings #5352
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5352 +/- ##
=======================================
Coverage 88.56% 88.57%
=======================================
Files 163 163
Lines 10624 10631 +7
Branches 1809 1812 +3
=======================================
+ Hits 9409 9416 +7
Misses 939 939
Partials 276 276
|
scrapy/crawler.py
Outdated
default.install() | ||
log_reactor_info() | ||
if self.settings.get("TWISTED_REACTOR"): | ||
verify_installed_reactor(self.settings["TWISTED_REACTOR"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works fine, tested this in my project. Minor thing, you could probably simplify this to something like this to avoid repeatedly calling self.settings.get('TWISTED_REACTOR')
reactor_class = self.settings.get("TWISTED_REACTOR")
if init_reactor:
if reactor_class:
install_reactor(reactor_class, self.settings["ASYNCIO_EVENT_LOOP"])
... etc
I also wonder if default value for init_reactor should be False? Are there any legitimate cases when you don't want to init reactor if you have it in settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll implement this simplification. As for the flag, it was the default behavior before this change, and the use case to not init the reactor is CrawlerRunner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I leave the conflict resolution to you :)
When is the next version containing this fix supposed to be released? Thanks! |
@AlvinSartorTrityum we don't currently have a date for the next release. |
Any updates on when this will be released? Would be very useful to have. |
This was released as part of 2.6 |
Closes: #4485