matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

SSS: Persist the `pos` token so that it gets reused across app restarts

Open erikjohnston opened this issue 1 year ago • 6 comments

Should only be done after https://github.com/matrix-org/matrix-rust-sdk/issues/3935

This is so that after restart we don't do an initial sync, which pulls in all the room data again (causing load on the server, and also on the client and bandwidth).

(cc. @Hywan)

erikjohnston avatar Sep 03 '24 13:09 erikjohnston

Thanks for creating the issue.

Hywan avatar Sep 03 '24 14:09 Hywan

For reference: we tried in the past and ran into sync issues (something something multiple processes on iOS because of NSE process? can't recall the details), so had to emergency-disable it: https://github.com/matrix-org/matrix-rust-sdk/blob/a737421875a1f1f81ac416dd4576fbd776d5d307/crates/matrix-sdk-ui/src/encryption_sync_service.rs#L106

PR disabling it: https://github.com/matrix-org/matrix-rust-sdk/pull/2525

bnjbvr avatar Sep 03 '24 14:09 bnjbvr

Oh my goodness :) After adding some logs in synapse I can confirm this is why the sync after an app restart is slow on Android.

Could we enable share_pos on the room list here without triggering cross processes dragons ?

If not can we make this an option so that we can store the pos at least on Android in the meantime ?

MatMaul avatar Sep 07 '24 19:09 MatMaul

Could we enable share_pos on the room list here without triggering cross processes dragons ?

I don't know if it's enough to not trigger dragons but it seems like the NotificationClient does not initialize the room list service in multiprocesses mode.

MatMaul avatar Sep 07 '24 19:09 MatMaul

The PR I've listed above disabled it for the encryption sync; we could enable it for the state sync, since the notification client uses a different connection id than the main app.

bnjbvr avatar Sep 09 '24 08:09 bnjbvr

FYI I've been running a modified version since a couple of days with share_pos on the room-list sliding sync instance and it's a night and day difference. As expected no trouble on my Android, but I don't have the means to test iOS.

MatMaul avatar Sep 12 '24 15:09 MatMaul

We are disabling share_pos() because it creates slowness (see #4244). Reopening this issue.

Hywan avatar Nov 13 '24 08:11 Hywan

Can we close this issue?

manuroe avatar Sep 15 '25 15:09 manuroe

Yep, let's consider it done after the latest attempt that appears to be quite successful in production builds.

bnjbvr avatar Sep 15 '25 15:09 bnjbvr

Thanks for the triaging!

Hywan avatar Sep 15 '25 15:09 Hywan