Skip to content

fix: retry a failed wear spark disconnect in the background #2181

Backlog

Description

@jvsena42

Part of #2105.
Source: review, #2177

On the watch, WalletRepo disconnects the Spark SDK when the app leaves the screen (after 10 s) or the watch locks. If BreezSdk.disconnect() throws, the SDK stays referenced and the next lock, pause, start or wipe tries again. While the app stays in the background or locked, though, nothing retries, so the SDK can keep running until the next foreground or lock change.

Related: when a wipe fails because its disconnect failed, the kept SDK still has its event listener, and its events can write the removed wallet's balance into the error state.

Proposal

  • Retry a failed disconnect with a bounded backoff while the app stays in the background or locked.
  • Ignore SDK events while the wallet is not in a connected status (or after a failed wipe).

Done when

  • Unit tests cover a disconnect that fails, then succeeds on retry while the app stays in the background, and a failed wipe whose events no longer update the state.

Found in review rounds 5–7 of the Wear OS foundation PR. Rare: it needs the SDK's disconnect to throw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions