pollTransactionStatus jobs are launched per pending transaction and tracked in
pollingTransactionJobs (ConcurrentHashMap). A job removes itself in finally
when its transaction finalizes or times out, but it is NOT cancelled when the
transaction leaves the observed set — e.g. on wallet switch.
observePollingTransactions' flatMapLatest swaps the upstream, yet jobs started
for the previous wallet keep network-polling until their own tx resolves.
This is not an unbounded leak (self-cleaning, bounded by pending count), but
stale jobs do extra polling after a wallet switch.
Proposal: in the collect, diff the current id set against
pollingTransactionJobs.keys and cancel jobs no longer present; or scope job
lifetime to the current walletId. No change to status-polling semantics.
File: android/data/repositories/src/main/kotlin/com/gemwallet/android/data/repositories/transactions/TransactionsRepositoryImpl.kt
(observePollingTransactions ~line 181, pollTransactionStatus ~line 199)
pollTransactionStatusjobs are launched per pending transaction and tracked inpollingTransactionJobs(ConcurrentHashMap). A job removes itself infinallywhen its transaction finalizes or times out, but it is NOT cancelled when the
transaction leaves the observed set — e.g. on wallet switch.
observePollingTransactions' flatMapLatest swaps the upstream, yet jobs startedfor the previous wallet keep network-polling until their own tx resolves.
This is not an unbounded leak (self-cleaning, bounded by pending count), but
stale jobs do extra polling after a wallet switch.
Proposal: in the collect, diff the current id set against
pollingTransactionJobs.keysand cancel jobs no longer present; or scope joblifetime to the current walletId. No change to status-polling semantics.
File: android/data/repositories/src/main/kotlin/com/gemwallet/android/data/repositories/transactions/TransactionsRepositoryImpl.kt
(observePollingTransactions ~line 181, pollTransactionStatus ~line 199)