-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Limit rainbird aiohttp client session to a single connection #112146
Conversation
Hey there @konikvranik, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@@ -36,9 +35,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | |||
|
|||
hass.data.setdefault(DOMAIN, {}) | |||
|
|||
clientsession = async_create_clientsession() | |||
entry.async_on_unload(clientsession.close) |
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.
Probably close the session on Home Assistant stop too.
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 considered this, but intentionally left this out because it seemed like a lot of code with unclear benefit to me. I think it makes sense for a connection pool with thousands of connections, but for a single connection it seemed fine to just wait for unload? I've sent PR #112292 however since you've asked for 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.
What do you mean "to just wait for unload"?
Limit rainbird to a single open http connection
Proposed change
Limit rainbird aiohttp client session to a single connection so that any concurrent requests are queued rather than issued in parallel. This should fix any issues with rainbird stability due to concurrent requests either from the data coordinator, UI, or automations.
Manually tested:
Additionally manually tested config flows, adding and removing/disabling the config entries, etc and verifying all connections are closed properly.
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
..coveragerc
.To help with the load of incoming pull requests: