-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
Adapt static resource handler to aiohttp 3.10 #123166
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
This is much nicer than #121831 👍 |
if not isinstance(response, FileResponse): | ||
# Must be directory index; ignore caching | ||
return response | ||
file_path = response._path # noqa: SLF001 |
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.
It would be nice to do a PR to aiohttp to expose this property as part of the API so we don't have the protected access here.
Thanks @steverep This is a nice cleanup. Glad 3.10 is going well. |
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.
Marking request changes so I get the ping back when its ready again
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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 great. Really nice cleanup. Thanks @steverep
The pathlib performance should be a bit better in cpython 3.13 as well
I noticed this didn't make it into b5. Can we put this in the next beta to enable the upstream |
Proposed change
The static resource handler contains a lot of code copied from
aiohttp
's base class, manipulated to run file system operations in an executor. Much of this logic has been rewritten in 3.10 to fix several issues, as well as now running any file system calls in an executor. This change strips out all the copied code, and simply wraps the super class method to cache the path resolution and content type lookup as done now.Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: