-
-
Notifications
You must be signed in to change notification settings - Fork 28.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
Fix invalid state #16558
Fix invalid state #16558
Conversation
homeassistant/core.py
Outdated
@@ -1042,10 +1043,13 @@ def call(self, domain: str, service: str, | |||
This method is a coroutine. | |||
""" | |||
context = context or Context() | |||
self._call_id += 1 | |||
call_id = self._call_id |
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.
We should use uuid4. Because we can restore the context object and the caller ID is not equal anymore.
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.
the call ID is not part of the context, it's only used by the service registry during run time?
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.
Using uuid 4 now.
* Fix invalid state * Make slightly more efficient in unsubscribing * Use uuid4"
Description:
In #15674 we started checking if a service was done by comparing context. This was an incorrect assumption as context has to propagate. So when we added that in #16415, the service executed handler could be called twice.
This fixes it by restoring unique call IDs for service calls.
Related issue (if applicable): fixes #16544
Checklist:
tox
. Your PR cannot be merged unless tests passIf the code does not interact with devices: