Skip to content

fix: debounce network-state subscription to connected boolean only#958

Merged
bmc08gt merged 3 commits into
code/cashfrom
fix/bidi-resilience-and-contact-sync-storm
Jun 20, 2026
Merged

fix: debounce network-state subscription to connected boolean only#958
bmc08gt merged 3 commits into
code/cashfrom
fix/bidi-resilience-and-contact-sync-storm

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

bmc08gt added 2 commits June 20, 2026 09:32
…an only

The ContactCoordinator subscribed to the full NetworkState (connected +
signalStrength + type). Signal-strength or connection-type fluctuations
passed through distinctUntilChanged() and each triggered a full contact
sync — up to 44 times in 270ms during a charger-connect event.

Fix: map to just the connected boolean before distinctUntilChanged so
only actual connectivity transitions trigger sync.

Bugsnag: 6a3686f3d2c3b94118b56442
…initial send

When the gRPC response flow errors immediately after creation, the
.catch block closes the requestChannel before send(initialRequest())
completes, throwing ClosedSendChannelException. This is a transient
condition (the stream died during setup) and should always be retried.

Previously this was treated as a terminal error, reported to Bugsnag,
and the stream gave up. Now it continues the retry loop, bounded by
maxReconnectAttempts.

Bugsnag: 6a3686f3d2c3b94118b56442
Signed-off-by: Brandon McAnsh <[email protected]>
@bmc08gt bmc08gt self-assigned this Jun 20, 2026
@github-actions github-actions Bot added type: fix Bug fix area: network gRPC, connectivity, API, exchange rates labels Jun 20, 2026
AccountController and TokenCoordinator had the same bug as
ContactCoordinator — subscribing to the full NetworkState instead of
just the connected boolean, causing redundant work on signal-strength
or connection-type changes.

AccountController was worse: no distinctUntilChanged at all, so every
NetworkState emission triggered fetchAdditionalAccountInfo().

Bugsnag: 6a3686f3d2c3b94118b56442
Signed-off-by: Brandon McAnsh <[email protected]>
@github-actions github-actions Bot added the area: tokens Token accounts, balances, token info label Jun 20, 2026
@bmc08gt bmc08gt merged commit 779eda2 into code/cash Jun 20, 2026
3 checks passed
@bmc08gt bmc08gt deleted the fix/bidi-resilience-and-contact-sync-storm branch June 20, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates area: tokens Token accounts, balances, token info type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant