Polling Bug#502
Conversation
- Only poll for active account
…into beast/polling-bug
|
I have enough context. Here's my review: PR #502 Review: Polling Bug FixThe refactor is a solid direction — narrowing polling to the active account avoids the wasteful fan-out across every visited wallet, and the new Critical: Double-scheduled timer on
|
|
We already have remote notification. So this is intentional to not send notification for non active account.
This is nonsense. We don't skip. We don't do recon if there is nothing to recon. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 62e6719. Configure here.
| _ref, | ||
| accountIds: [accountId], | ||
| action: (notifier) => notifier.silentRefresh(), | ||
| onlyIfAlive: accountId == activeId, |
There was a problem hiding this comment.
Reconciliation onlyIfAlive condition is inverted
Medium Severity
The onlyIfAlive: accountId == activeId condition is inverted. This sets onlyIfAlive to true for the active account (potentially skipping it) and false for non-active accounts (unconditionally creating their providers). The intent is the opposite: the active account's provider is the one that's definitely alive and always worth refreshing, while non-active accounts involved in pending transactions are the ones that might not have providers alive and shouldn't have them created. The condition likely needs to be accountId != activeId to align with the PR's goal of not polling non-active accounts.
Reviewed by Cursor Bugbot for commit 62e6719. Configure here.
| /// Manually trigger a check for all monitored transfers (useful for testing) | ||
| Future<void> forceCheckAllMonitoredTransfers() async { | ||
| if (_executionPollers.isNotEmpty) { | ||
| await _ref.read(paginationControllerProvider.notifier).silentRefresh(); |
There was a problem hiding this comment.
Subscription not closed in dispose method
Medium Severity
The new _txSubscription field is closed in the lifecycle handler and in _listenToTransactions, but dispose() does not close it. When the provider is torn down via ref.onDispose(service.dispose), the ProviderSubscription will remain open, leaking the listener and preventing proper garbage collection.
Reviewed by Cursor Bugbot for commit 62e6719. Configure here.
|
|
||
| // Use silent refresh for background updates | ||
| await _ref.read(paginationControllerProvider.notifier).silentRefresh(); | ||
| await silentRefreshActiveAccount(_ref); |
There was a problem hiding this comment.
Silent refresh triggered twice for active account
Low Severity
triggerSilentRefresh calls silentRefreshActiveAccount(_ref) directly, and then _reversibleMonitor.forceCheckAllMonitoredTransfers() also calls silentRefreshActiveAccount(_ref) internally when there are active execution pollers. This results in the active account's pagination being refreshed twice redundantly during a single silent refresh cycle.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 62e6719. Configure here.


Summary
Fixed the bug of polling visited accounts even though not active.
Note
Medium Risk
Changes when balances and history refresh across multi-account wallets; non-active views may stay stale until opened, while fixing incorrect background polling of inactive accounts.
Overview
Background and manual history polling no longer refresh every wallet account or the global pagination controller. Polling is centralized in
polling_refresh_scope, which limits routine updates to the active account (silent refresh and balance invalidation only when the filtered pagination provider is already alive).Event-driven paths still target the right accounts: pending-tx discovery and reconciliation refresh the active account plus senders/receivers involved in pending txs, without fan-out to unrelated accounts. Reconciliation now matches pending items against per-account filtered pagination cache instead of the aggregate
allTransactionsstream.Reversible transfer monitoring watches the active account’s transaction list only, updates pagination for affected from/to accounts on execution, and drops wallet-wide controller updates. Account switch triggers a dedicated refresh (silent vs loading based on whether chain data was loaded).
Unit tests cover refresh target deduplication and reconciliation account scoping.
Reviewed by Cursor Bugbot for commit 62e6719. Bugbot is set up for automated code reviews on this repo. Configure here.