Skip to content

fix(hub): reset connection backoff when a remote service is registered - #110

Open
andig wants to merge 1 commit into
enbility:devfrom
andig:upstream/reset-connection-backoff
Open

andig wants to merge 1 commit into
enbility:devfrom
andig:upstream/reset-connection-backoff

Conversation

@andig

@andig andig commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

RegisterRemoteService expresses fresh connection intent, but the per-SKI retry state survived it: the attempt counter kept whatever level earlier failures had reached, so the next attempt was deferred by the 10-20s range even though the caller had just asked for the connection.

A pending delay timer made it worse. UnregisterRemoteService removed the attempt counter but left the timer in place, and with it connectionAttemptRunning set to true. coordinateConnectionInitations returns early in that state, so the following registration's attempt was swallowed until the stale timer fired.

This is visible from an application waiting for a device connection: evcc's device configuration test aborts after a fixed timeout, and once the backoff had escalated it never saw a connection again (evcc-io/evcc#25058 — delays of 14.2s, 12.9s and 10.2s against a 10s window, with the connection succeeding immediately after a restart).

Changes:

  • RegisterRemoteService cancels a pending delay timer and drops the attempt counter before triggering discovery
  • UnregisterRemoteService cancels the delay timer as well, so it no longer leaves the attempt flag set

The automatic retry behaviour on repeated failures is unchanged — only an explicit register/unregister resets it.

Test Test_RegisterRemoteServiceResetsBackoff covers the reset; it fails on dev without the change. Full hub package passes.


🤖 Generated with Claude Code

@coveralls

coveralls commented Aug 23, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 93.114% (+0.09%) from 93.027% — andig:upstream/reset-connection-backoff into enbility:dev

@andig

andig commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@sthelen-enqs could you take a look and merge this if it is fine? It is part of the fork evcc currently ships, and getting it into dev would let us drop the fork. Rebased on current dev, CI is green.

Registering a remote service expresses fresh connection intent, but the
per-SKI retry backoff (up to 10-20s) and a pending delay timer survived,
deferring the attempt far beyond what a caller waiting for the connection
expects. Cancel both on register, and cancel the pending timer on
unregister as well so it no longer keeps the attempt flag set.
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