Skip to content

feat(core-backend): add debouncer system notifications in AccountActivity - #9700

Open
Kriys94 wants to merge 1 commit into
mainfrom
feat/AccountActivityDebouncer
Open

feat(core-backend): add debouncer system notifications in AccountActivity#9700
Kriys94 wants to merge 1 commit into
mainfrom
feat/AccountActivityDebouncer

Conversation

@Kriys94

@Kriys94 Kriys94 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Explanation

Without Debouncer: https://www.loom.com/share/e96ef8f592254e9baaad15e86e823fa4

With Debouncer: https://www.loom.com/share/eddb747eb72b4a6eb8e880e9a942ac12

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes real-time chain status signaling timing and payload shape for downstream listeners (e.g. polling coordination); disconnect path behavior is intentionally altered to drop pending ups.

Overview
AccountActivityService no longer publishes AccountActivityService:statusChanged on every system notification. Incoming chain up/down updates are buffered per chain, the flush timer resets on each notification (1s base + up to 1s random jitter), and flush emits at most one batched event per status (up and down separately) with merged chainIds. Debounced publishes no longer include timestamp (disconnect-driven down events still can).

Pending buffers and timers are cleared on WebSocket disconnect (so stale up events are not emitted after a disconnect down flush) and cancelled in destroy(). Changelog documents the behavior change; tests use fake timers for batching, timer reset, jitter, disconnect, and destroy.

Reviewed by Cursor Bugbot for commit 0068c48. Bugbot is set up for automated code reviews on this repo. Configure here.

@Kriys94 Kriys94 changed the title feat(core-backend): add debouncer system notifications in AccountActi… feat(core-backend): add debouncer system notifications in AccountActivity Jul 29, 2026
@Kriys94
Kriys94 force-pushed the feat/AccountActivityDebouncer branch from b6333f9 to 0068c48 Compare July 29, 2026 20:50
@Kriys94
Kriys94 marked this pull request as ready for review July 30, 2026 07:58
@Kriys94
Kriys94 requested review from a team as code owners July 30, 2026 07:58
@Kriys94
Kriys94 temporarily deployed to default-branch July 30, 2026 07:58 — with GitHub Actions Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0068c48. Configure here.

clearTimeout(this.#statusChangeDebouncer.timer);
this.#statusChangeDebouncer.timer = null;
}
this.#statusChangeDebouncer.pendingChanges.clear();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Disconnect drops pending chain downs

High Severity

#chainsUp is updated immediately on each system notification, but statusChanged is only published after the debounce window. On disconnect, buffered changes are cleared and only remaining #chainsUp entries are marked down. Chains that flipped to down inside the window are already removed from #chainsUp, so their pending down is discarded and never published. Consumers such as TokenBalancesController can keep treating those chains as up (slow websocket polling) through an outage, when downs and disconnects often arrive together.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0068c48. Configure here.

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.

1 participant