-
Notifications
You must be signed in to change notification settings - Fork 2.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
[Python] Fix subscription error handling and re-subscription #34372
Merged
mergify
merged 2 commits into
project-chip:master
from
agners:python-improve-subscription-handling
Jul 18, 2024
Merged
[Python] Fix subscription error handling and re-subscription #34372
mergify
merged 2 commits into
project-chip:master
from
agners:python-improve-subscription-handling
Jul 18, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently the error callback is only called when the future is not done yet and the subscription handler exists. However, the subscription handler only gets initialized on successful subscription, which is also where the future gets set to done. So there is no situation where the error callback is being called, currently. Fix this by calling the error callback straight from the Matter SDK Thread when the subscription handler exists. This makes it independent of the future.
agners
changed the title
[Python] Improve subscription handling
[Python] Fix re-subscription and error handling
Jul 17, 2024
pullapprove
bot
requested review from
andy31415,
andyg-apple,
anush-apple,
arkq,
axelnxp,
bauerschwan,
bzbarsky-apple,
carol-apple,
cecille,
chapongatien,
chrisdecenzo,
chshu,
chulspro,
cliffamzn,
Damian-Nordic,
dhrishi,
doru91,
fessehaeve,
harimau-qirex,
harsha-rajendran,
hawk248,
hicklin,
jepenven-silabs,
jmartinez-silabs,
jmeg-sfy,
joonhaengHeo and
jtung-apple
July 17, 2024 13:23
pullapprove
bot
requested review from
robszewczyk,
saurabhst,
selissia,
sharadb-amazon,
tcarmelveilleux,
tecimovic,
tehampson,
tima-q,
tobiasgraf,
turon,
vivien-apple,
wiba-nordic,
woody-apple,
younghak-hwang and
yufengwangca
July 17, 2024 13:23
agners
changed the title
[Python] Fix re-subscription and error handling
[Python] Fix subscription error handling and re-subscription
Jul 17, 2024
PR #34372: Size comparison from a30dd12 to df9013b Full report (49 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, tizen)
|
Make sure we update the subscription ID in the subscription established callback when the subscription handler already exists. This makes sure that we have the correct subscription ID stored in the `SubscriptionTransaction` object after successfully re-subscribe too.
agners
force-pushed
the
python-improve-subscription-handling
branch
from
July 17, 2024 14:21
df9013b
to
7bcf095
Compare
PR #34372: Size comparison from a30dd12 to 7bcf095 Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
cecille
approved these changes
Jul 17, 2024
tehampson
approved these changes
Jul 17, 2024
arkq
approved these changes
Jul 18, 2024
agners
added a commit
to home-assistant-libs/chip-wheels
that referenced
this pull request
Jul 18, 2024
This adds Subscription fixes from the master branch to our 1.3 branch. Specifically, this only auto re-subscribes after an initial subscription succeeded. With that the Read call no longer hangs forver in case there is a communication issue with the device. Specifically, this integrates changes from the following PRs - project-chip/connectedhomeip#34370 - project-chip/connectedhomeip#34372
j-ororke
pushed a commit
to j-ororke/connectedhomeip
that referenced
this pull request
Jul 31, 2024
…-chip#34372) * [Python] Fix error callback in AsyncReadTransaction Currently the error callback is only called when the future is not done yet and the subscription handler exists. However, the subscription handler only gets initialized on successful subscription, which is also where the future gets set to done. So there is no situation where the error callback is being called, currently. Fix this by calling the error callback straight from the Matter SDK Thread when the subscription handler exists. This makes it independent of the future. * [Python] Update subscription id on re-subscribe Make sure we update the subscription ID in the subscription established callback when the subscription handler already exists. This makes sure that we have the correct subscription ID stored in the `SubscriptionTransaction` object after successfully re-subscribe too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the error callback is only called when the future is not done yet and the subscription handler exists. However, the subscription handler only gets initialized on successful subscription, which is also where the future gets set to done. So there is no situation where the error callback is being called, currently.
Fix this by calling the error callback straight from the Matter SDK Thread when the subscription handler exists. This makes it independent of the future. With this, the error callback is actually called when there is a subscription error.
Also make sure we update the subscription ID in the subscription established callback when the subscription handler already exists. This makes sure that we have the correct subscription ID stored in the
SubscriptionTransaction
object after successfully re-subscribe too.