Skip to content

Retry on missing server at startup#36

Merged
shsms merged 4 commits into
frequenz-floss:v0.x.xfrom
shsms:startup-retry
May 8, 2026
Merged

Retry on missing server at startup#36
shsms merged 4 commits into
frequenz-floss:v0.x.xfrom
shsms:startup-retry

Conversation

@shsms
Copy link
Copy Markdown
Collaborator

@shsms shsms commented May 8, 2026

Currently microgrid-rs retries when an existing connection is lost, but when there's not server available at startup, it exits immediately.

This PR changes that:

  • MicrogridClientHandle::try_new returns immediately with a lazily established connection to the API.
  • LogicalMeterHandle::try_new awaits until a server is available, so that it can build the a component graph.

shsms added 4 commits May 7, 2026 15:00
Expose combine_parallel, intersect, and merge_if_overlapping on Bounds
so external callers can reuse them.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Replace the eager Channel::connect call in MicrogridClientHandle::try_new
with Endpoint::connect_lazy, so a missing server at startup no longer
causes the calling app to exit immediately.  Connection errors now
surface per-RPC, where the actor's existing per-stream retry loop can
recover once the server becomes reachable.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Wrap the entire fetch-and-build sequence (list components, list
connections, build the component graph) in a single retry loop that
sleeps 3 seconds between attempts and keeps trying until it succeeds.
This way, transient API failures and graph-build errors stemming from
incomplete server-side data both clear themselves up without aborting
the calling app at startup.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Copy link
Copy Markdown

@matthias-wende-frequenz matthias-wende-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved under promise that there will be a jitter or exponential backoff follow up PR

@shsms shsms added this pull request to the merge queue May 8, 2026
Merged via the queue into frequenz-floss:v0.x.x with commit 39419cc May 8, 2026
3 checks passed
@shsms shsms deleted the startup-retry branch May 8, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants