-
Notifications
You must be signed in to change notification settings - Fork 199
fix: catch exceptions for checkin_response #1715
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
Conversation
Add callback wrapper to application controller that catches exceptions heading for event loop and logs these with device context Remove the now unneeded handling of this in CallbackListener.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1715 +/- ##
=======================================
Coverage 99.29% 99.29%
=======================================
Files 63 63
Lines 12263 12271 +8
=======================================
+ Hits 12177 12185 +8
Misses 86 86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This fix is needed for problems with device checkins and also other cases like end device is offline or having problems that is not possible see what device is having the problems only "some" ZHA devices as its today. |
| async def test_callback_wrapping( | ||
| app: zigpy.application.ControllerApplication, ieee, caplog | ||
| ) -> None: | ||
| # The default is True |
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.
nit: stale comment
| # The default is True |
| async def test_callback_wrapping_async( | ||
| app: zigpy.application.ControllerApplication, ieee, caplog | ||
| ) -> None: | ||
| # The default is True |
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.
nit: stale comment
| # The default is True |
|
|
||
| def wrap_callback( | ||
| self, src: zigpy.device.Device | zigpy.listeners.ANY_DEVICE, callback: _C | ||
| ) -> _C: |
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.
So this likely doesn't really matter with how we use it, but for a sync callback, the returned callable can now also return None if an exception occurs. So, the return type is not really _C anymore.
For async callbacks, the returned wrapper is a sync function that fires the task and returns None, so also not _C at all.
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.
Hmm. I suppose it might be possible to unwrap the callable into its basic elements like the register function is defined and add the None return. We could probably also just have it be a none return.
Add callback wrapper to application controller
that catches exceptions heading for event loop
and logs these with device context
Remove the now unneeded handling of this
in CallbackListener.