Repository navigation
fix: keep foreground inbox checks responsive - #1321
Conversation
|
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
|
Fixed the matching reconnect issue found during review of synonymdev/bitkit-ios#769 in d8f3e43. Reconnecting now restarts the existing polling job only if foreground polling is active, so it does not remain asleep on the old 120-second backoff or start a background loop. Extended the existing reconnect test to verify ten-second checks after offline backoff and after the initial burst has ended. Compile, all 2,743 unit tests, and lint pass. |
jvsena42
left a comment
There was a problem hiding this comment.
No findings at 26faac5e9.
PaykitPaymentRequestRepo.kt is identical to master at head, so the new repo test peer intake failure does not drop received requests pins behaviour that already existed.
Checked and clean:
- No auto-pay. The poll path goes
refresh()→presentIncomingPaymentRequestOrStop()→beginPaymentRequest(), which only resolves the request, thenopenContactPayment()opens the Send sheet. Payment still needs user confirmation. Subscription proposals go to the Review sheet. - Overlapping polls. The periodic job, the 15-shot burst, the reconnect refresh and the notification-tap refresh all serialise on
operationMutex.dismiss,markPresentedanddismissSubscriptionPaymenttake the same mutex, so a stale concurrent refresh cannot bring back a dismissed or declined request. Presentation is single-flighted byisPresentingPaymentRequestand generation counters. - Cancellation. Reconnect now cancels the job in the foreground.
synchronizeLockeddoes all remote calls first and writes state at the end, so a cancel mid-refresh leaves state untouched.runSuspendCatchingrethrows beforediscardExpiredRequestsLocked()runs. - Reconnect vs ON_STOP. No suspension point sits between
cancel()andstartPaykitPaymentRequestPolling(), and both run on Main, so a stopped app never gets a background loop. - Runaway. The interval is a fixed 10 s, foreground only. Offline ticks do no I/O, and
isOnlineis conflated. The 30/60/120 s maintenance cadence is unchanged. - Gating.
refreshIncomingPaykitPaymentRequestsandrefreshPaymentRequestTargetsreturn early when Paykit is disabled or no wallet exists. - Parity with synonymdev/bitkit-ios#769. Both use the same fixed 10 s interval and the same reconnect side effects. iOS cancels the loop while offline, and Android keeps ticking with
continue; the net behaviour is the same. The restart-on-reconnect (749-753) is redundant now that the backoff is gone. It is harmless.
This PR keeps foreground Paykit inbox checks on a ten-second interval while online so an idle inbox or failed check does not slow down subsequent requests.
iOS counterpart: synonymdev/bitkit-ios#769
Description
Out of Scope
Design
N/A — no UI changes.
Preview
N/A — no UI changes.
QA Notes
Manual Tests
Automated Checks
AppViewModelSendFlowTest.kt: unchanged and failed inbox rounds retain ten-second checks, maintenance remains slower, offline periodic work is skipped, reconnect resumes promptly and stopping polling cancels subsequent checks. The prior failure-backoff test now verifies fixed cadence through failure and recovery.PaykitPaymentRequestRepoTest.kt: SDK-reported peer errors do not discard received requests.-Dmaven.repo.local=/private/tmp/bitkit-fixed-inbox-empty-mavento bypass local Maven overrides.