Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix StatusCode in watchdog loop #1375

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions asyncua/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,11 @@ async def _monitor_server_loop(self):
_ = await self.nodes.server_state.read_value()
except ConnectionError as e:
_logger.info("connection error in watchdog loop %s", e, exc_info=True)
await self.uaclient.inform_subscriptions(ua.StatusCodes.BadShutdown)
await self.uaclient.inform_subscriptions(ua.StatusCode(ua.StatusCodes.BadShutdown))
raise
except Exception:
_logger.exception("Error in watchdog loop")
await self.uaclient.inform_subscriptions(ua.StatusCodes.BadShutdown)
await self.uaclient.inform_subscriptions(ua.StatusCode(ua.StatusCodes.BadShutdown))
raise

async def _renew_channel_loop(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def status_change_notification(self, status: ua.StatusChangeNotification):
# check if connection is alive
await cl.check_connection()
# check if the status_change_notification was triggered
assert myhandler.status == ua.StatusCodes.BadShutdown
assert myhandler.status.value == ua.StatusCodes.BadShutdown
# check if exception is correct rethrown on second call
with pytest.raises(ConnectionError):
await cl.check_connection()
Expand Down