Skip to content
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

Switch to limit per host on tcp connector #104

Merged
merged 3 commits into from
Jan 31, 2022
Merged

Conversation

marcelveldt
Copy link
Collaborator

According to Signify support it is very important that we have a guard in place to make sure that there are no more than 3 concurrent requests to the bridge. Putting this guard on the TCP Connector for aiohttp solves all 503 errors.

Sending 100 requests now completes in 2,2 seconds without a single 503 error ;-)

I've put a small detection in the code if a TCP connector is given without this limit (e.g. Home Assistant as a temporary measure until we can adjust the global logic in HA to respect this host limit.

@@ -48,7 +45,16 @@ def __init__(
self._app_key = app_key
self._websession = websession
self._websession_provided = websession is not None

if websession and (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we just always make our own.

@balloob balloob merged commit abae6fd into master Jan 31, 2022
@balloob balloob deleted the fix-concurrent-requests branch January 31, 2022 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants