1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Add a save() method to the store interface

Originally I just piggy-backed off setSyncToken() but this was]
non-obvious that depending on the store it might do writes to the
database. This was exacerbated by the fact that the save needs to
be done at the "right time" (after sync data is accumulated and
after the sync response has been processed) and setSyncToken was
being called too early.

A save() method fixes both these things.
This commit is contained in:
Kegan Dougal
2017-02-09 17:25:40 +00:00
parent db24690d9b
commit 6e7b9472be
4 changed files with 18 additions and 8 deletions

View File

@@ -570,6 +570,10 @@ SyncApi.prototype._sync = function(syncOptions) {
// keep emitting SYNCING -> SYNCING for clients who want to do bulk updates
self._updateSyncState("SYNCING", syncEventData);
// tell databases that everything is now in a consistent state and can be
// saved.
client.store.save();
self._sync(syncOptions);
}, function(err) {
if (!self._running) {