Skip to content

Commit

Permalink
Explicitly guard store usage during sync startup
Browse files Browse the repository at this point in the history
This adds explicit `try` blocks in the spots where we interact with the store
during sync startup. This shouldn't be necessary as the store should already be
catching this and degrading as of
matrix-org#884, but that doesn't seem to
have been enough for the affected user in
element-hq/element-web#7769, as they are seeing sync just
stop when storing without any further detail.
  • Loading branch information
jryans committed Apr 9, 2019
1 parent 420b4d1 commit b0c3d0d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,16 @@ SyncApi.prototype.sync = function() {
const supported = await client.doesServerSupportLazyLoading();
if (supported) {
debuglog("Creating and storing lazy load sync filter...");
this.opts.filter = await client.createFilter(
Filter.LAZY_LOADING_SYNC_FILTER,
);
try {
this.opts.filter = await client.createFilter(
Filter.LAZY_LOADING_SYNC_FILTER,
);
} catch (err) {
console.error(
"Creating and storing lazy load sync filter failed",
err,
);
}
debuglog("Created and stored lazy load sync filter");
} else {
debuglog("LL: lazy loading requested but not supported " +
Expand All @@ -528,7 +535,11 @@ SyncApi.prototype.sync = function() {
this.opts.crypto.enableLazyLoading();
}
debuglog("Storing client options...");
await this.client._storeClientOptions();
try {
await this.client._storeClientOptions();
} catch (err) {
console.error("Storing client options failed", err);
}
debuglog("Stored client options");

getFilter(); // Now get the filter and start syncing
Expand Down

0 comments on commit b0c3d0d

Please sign in to comment.