This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improve
reactor_tick_time
metric #11724Improve
reactor_tick_time
metric #11724Changes from all commits
6c821fa
05bdebd
fb74ba7
45051e8
3dbc342
3f55267
584e2e9
93207af
c89abc2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
When would the reactor not be epoll-based?
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.
whenever
select.epoll
doesn't exist, which basically means we're not running on Linux: https://docs.python.org/3/library/select.html#select.epollThere 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.
You can see how the reactor is chosen at: https://github.com/twisted/twisted/blob/twisted-20.3.0/src/twisted/internet/default.py#L41-L53 (there's a handful of others you can install manually too...)
Would it make more sense to check if the reactor is. Both
PollReactor
andEPollReactor
have a_poller
attribute, but obviously only one is of typeepoll
.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.
There's an
isinstance(poller, epoll)
check below which I think does what you're asking?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.
Errr, yes the code is mostly doing what I thought.
I was wondering if it makes sense to check that the reactor is an
EPollReactor
instead, in case there's some other reactor that someone is using with a_poller
attribute. I think it still wouldn't be anepoll
though, and if it is the wrapper should work fine. So LGTM!