Fix for a regression which broke sensors which rely on select.poll() functionality #4118
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.
Background
In v2.7.0 we upgraded eventlet to the latest stable version. That stable version removed
select.poll()
which was available in previous releases (but it was blocking) to make it harder for users to "accidentally" use blocking code.That change broke some sensors which rely on
select.poll()
functionality.Users would see an error similar to one below:
Proposed solution
This PR adds
select
module which includes blocking version ofpoll()
back tosys.modules
so it can be used by the sensors which need it.The behavior will now be the same as in releases prior to v2.7.0. Blocking code is not great and ideally we could avoid it where we can, but sadly we have no control over 3rd party libraries and integrations which use that blocking code construct.
Keep in mind, that each sensor is running in a separate and dedicated process so blocking inside that process it not that big of deal (compared to blocking in a main service process which would be a no go).
Related issues #3968 #4007 #4094
Resolves #4094