Fix offline flag forwarding and load subdevice trees from the OSW backend - #7
Merged
Merged
Conversation
_handle_data_change reads _offline from the archive database to detect the online/offline transition, but the flag only existed on the driver, so _on_archive_error never fired.
DataToolMixin.load_from_osw walks Tool.components and populates the controller-only subdevices list. Component instance IRIs are read from __iris__ so no schema is autofetched. Adds rebuild_channel_dict() to reindex channels after the tree is wired.
This file contains hidden or 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
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.
fix: expose driver
_offlineflag on PostgREST controllerDataToolMixin._handle_data_changereads_offlinefrom the archive database todetect the online/offline transition, but the flag only existed on
PostgrestDatabaseDriver. Thegetattralways returnedFalse, so_on_archive_error()never fired andreset_opcua_connection_on_errorwas deadcode - a controller kept logging into the void while the database was unreachable.
Forwards
_offlineand_emulate_offlinefrom the driver on both the v1 and v2controllers.
feat: load subdevice tree from the OSW backend components relation
DataToolMixin.load_from_oswwalksTool.componentsand populates thecontroller-only
subdeviceslist, soget_all_channels(),get_channel_owner()and archiving work across a whole device hierarchy loaded from the backend.
Component instance IRIs are read from
__iris__rather than the attribute, so thelazy backend resolution (which would autofetch schemas and generate ad-hoc models)
is never triggered. Adds
rebuild_channel_dict()to reindex channels after thetree is wired, since subdevices are attached after
__init__.Tests
9 new tests. Full suite: 141 passed, 11 skipped.