Metadata.File: implement generateUpdateMetadataCacheNotification (fix backend-edge with file metadata) - #3865
Open
schlabsch wants to merge 1 commit into
Open
Conversation
The Backend.Edge.App (backend-edge) only starts its edge-facing websocket server once its cache is initialized from the Edge Manager's UpdateMetadataCache notification. The default Metadata.generateUpdateMetadataCacheNotification() returns an empty notification and is only overridden by the Odoo metadata, so deployments using file-based metadata can never accept Edge connections in the split backend / backend-edge topology. Publish the apikey-to-edgeId map from metadata.json so file-based deployments work with the backend-edge process.
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.
Problem
In the split backend / backend-edge topology (introduced 2026.2),
Backend.Edge.Apponly starts its edge-facing websocket server after its cache is initialized from the Edge Manager'sUpdateMetadataCachenotification (BackendEdgeServerApp.evaluateServerStart()requirescache.isInitialized(), which requires a non-empty apikey→edgeId map).Metadata.generateUpdateMetadataCacheNotification()has a default implementation returningUpdateMetadataCache.Notification.empty(), and only the Odoo metadata provides a real implementation. As a result, deployments usingMetadata.Filecan never accept Edge connections on any post-2026.1 backend: the backend-edge connects to the Edge Manager, receives an empty cache notification, and its edge websocket server (port 8081) never starts.Reproduced on 2026.4.0 and 2026.8.0 with the official docker images (
openems/backend+openems/backend-edge) and a standardmetadata.json.Fix
Override
generateUpdateMetadataCacheNotification()inMetadataFile: refresh the parsed file and publish the apikey→edgeId map for all configured edges — mirroring what the Odoo metadata does.Verified on a live deployment (backend 2026.8.0 + backend-edge 2026.8.0, file metadata, 6 edges): after this patch the backend-edge cache initializes, its edge server starts, edges authenticate by apikey and stream data end-to-end (websocket UI + InfluxDB timedata).