matrix-rust-sdk
matrix-rust-sdk copied to clipboard
`process_sync_changes` always updates `account` in the store
Every time process_sync_changes
is called, it persists the current state of the Account to the store (https://github.com/matrix-org/matrix-rust-sdk/blob/8deb0ff2e18c33d3588eef78e6040fe8a4d4cf41/crates/matrix-sdk-crypto/src/machine.rs#L1171-L1174).
IndexedDB storage operations can be quite slow, and since process_sync_changes
is called for every sync (indeed, three times for every sync on Web), this is quite expensive and can be rather slow.
I don't really follow why we need to store the account at this point (why not when we create the session?), but could we give it a 'dirty' bit to indicate whether it needs updating, rather than doing it unconditionally?