bitkit icon indicating copy to clipboard operation
bitkit copied to clipboard

[Bug]: Electrum lost connection and reconnection toast messages can display when network slows or on app resume

Open catch-21 opened this issue 10 months ago • 0 comments

Describe the bug

When the network slows or dips out, or even on re-opening the minimised app with stable network, the "Reconnecting to Electrum" toast message is displayed shortly followed by a reconnection toast message. It is of no use to the user if there is a temporary disconnect from Electrum, only if the issue persists. This toast message should be reserved for when the connection is truely broken, i.e. after x attempts and/or over some time period.

If I minimise the app and leave it a while (10+ mins), often on re-opening the app (on resume) I see the "Reconnecting to Electrum" toast message. Sometimes it will immediately follow with the the reconnection toast message and other times it does not immediately automatically reconnect. Regardless of the temporary connection status during the app restore process, the user does not need to know unless it is a persistent problem. We should avoid displaying toast messages unless the user has performed an action that requires immediate feedback.

Reproduce

This can be reproduced in an Andriod emulator environment by throttling the network down to a slow (e.g. hscsd/hsdpa) with poor signal. Toggling between slower and faster to simulate poor cell network, or even a public wifi network that is sharing resources between many devices, can quickly cause this toast to occur.

This is near impossible to reliably reproduce on app re-open. I suspect it is timing related (e.g. the app is minimised paused for some period and reopened at a time when some ping/status request is made to Electrum but the connection is temporarily not active)

  1. Have Bitkit running connected to network and Electrum server
  2. Minimise the app
  3. Wait for some time. I've usually seen it when app have been minimised for 10+ minutes
  4. Reopen the app (resume from minimised state)
  5. Observe Electrum toast message(s) If not, repeat. from step 2.

Screenshots / Recording

No response

Operating system

Android 13 TKQ1.220829.002

Bitkit version

v1.0.0-beta.113

Log output

No response

catch-21 avatar Apr 17 '24 15:04 catch-21