You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Merge pull request #892 from jryans/degraded-storage
Explicitly guard store usage during sync startup
This commit is contained in:
13
src/sync.js
13
src/sync.js
@@ -498,11 +498,19 @@ SyncApi.prototype.sync = function() {
|
|||||||
debuglog("Checking server lazy load support...");
|
debuglog("Checking server lazy load support...");
|
||||||
const supported = await client.doesServerSupportLazyLoading();
|
const supported = await client.doesServerSupportLazyLoading();
|
||||||
if (supported) {
|
if (supported) {
|
||||||
|
try {
|
||||||
debuglog("Creating and storing lazy load sync filter...");
|
debuglog("Creating and storing lazy load sync filter...");
|
||||||
this.opts.filter = await client.createFilter(
|
this.opts.filter = await client.createFilter(
|
||||||
Filter.LAZY_LOADING_SYNC_FILTER,
|
Filter.LAZY_LOADING_SYNC_FILTER,
|
||||||
);
|
);
|
||||||
debuglog("Created and stored lazy load sync filter");
|
debuglog("Created and stored lazy load sync filter");
|
||||||
|
} catch (err) {
|
||||||
|
console.error(
|
||||||
|
"Creating and storing lazy load sync filter failed",
|
||||||
|
err,
|
||||||
|
);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
debuglog("LL: lazy loading requested but not supported " +
|
debuglog("LL: lazy loading requested but not supported " +
|
||||||
"by server, so disabling");
|
"by server, so disabling");
|
||||||
@@ -527,9 +535,14 @@ SyncApi.prototype.sync = function() {
|
|||||||
if (this.opts.lazyLoadMembers && this.opts.crypto) {
|
if (this.opts.lazyLoadMembers && this.opts.crypto) {
|
||||||
this.opts.crypto.enableLazyLoading();
|
this.opts.crypto.enableLazyLoading();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
debuglog("Storing client options...");
|
debuglog("Storing client options...");
|
||||||
await this.client._storeClientOptions();
|
await this.client._storeClientOptions();
|
||||||
debuglog("Stored client options");
|
debuglog("Stored client options");
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Storing client options failed", err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
getFilter(); // Now get the filter and start syncing
|
getFilter(); // Now get the filter and start syncing
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user