-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use aiozoneinfo to avoid blocking io inside ZoneInfo #1232
Conversation
pyproject.toml
Outdated
@@ -28,6 +28,7 @@ version = "0.0.0" | |||
aiohttp = ">=3.0.0" | |||
python = "^3.11" | |||
yarl = ">=1.6.0" | |||
aiozoneinfo = "^0.2.1" |
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.
Instead of adding a dependency, we can also move this one out of the function scope and put it e.g., into a constant. The timezone isn't dynamic.
../Frenck
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.
I've updated the PR to instantiate a ZoneInfo on construct instead, is that how you would prefer it?
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.
That still makes it a class member.
Instead, it can be just defined as a constant at the top of the file and use the constant later on.
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.
Ah oh, sorry i misunderstood, i don't write python usually, so didn't know the Usual style rules,
I've made it into a const now
74bcda6
to
dd38109
Compare
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, @wslaghekke 👍
../Frenck
Proposed Changes
The current version throws a warning when used inside Home Assistant because of blocking calls to listdir, that happens inside the call to ZoneInfo, use
aiozoneinfo
to avoid blockingRelated Issues