mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
d59120aad0
Synapse deletes sliding sync connections that have been unused for 7 days. When an OEM battery manager has kept the application frozen for longer than that, the next sliding sync request is answered 400 M_UNKNOWN_POS. The Rust SDK handles that: it resets `pos` and, in offline mode, restarts the sync. When that recovery gives up, the sync service ends up in the Error or Terminated state and stops for good, and it is then up to the application to call start() again. Element X iOS does it, we do not: SyncOrchestrator only restarts the sync service when its state is Idle, so the sync stays dead for the rest of the process lifetime. Nothing recovers from there. The sync never reaches Running, so waitForE2eeInitializationTasks() never returns, the session verified status stays Unknown, and the FTUE is stuck on WaitingForInitialState. Clearing the application data is the only workaround. Restart the sync service when it is in the Error or Terminated state, with an exponential backoff from 1s to 30s to avoid hammering a failing homeserver. The backoff is only reset once the sync service has been running for a while, since startSync() moves the state to Running right away. Fixes #7689 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>