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

Merge pull request #470 from matrix-org/rav/fix_error_on_shutdown

Avoid throwing an unhandled error when the indexeddb is deleted
This commit is contained in:
David Baker
2017-06-20 15:46:55 +01:00
committed by GitHub
2 changed files with 9 additions and 0 deletions

View File

@@ -96,6 +96,7 @@ export default class OutgoingRoomKeyRequestManager {
* Called when the client is stopped. Stops any running background processes.
*/
stop() {
console.log('stopping OutgoingRoomKeyRequestManager');
// stop the timer on the next run
this._clientRunning = false;
}
@@ -229,6 +230,12 @@ export default class OutgoingRoomKeyRequestManager {
this._sendOutgoingRoomKeyRequests().finally(() => {
this._sendOutgoingRoomKeyRequestsRunning = false;
}).catch((e) => {
// this should only happen if there is an indexeddb error,
// in which case we're a bit stuffed anyway.
console.warn(
`error in OutgoingRoomKeyRequestManager: ${e}`,
);
}).done();
};

View File

@@ -91,9 +91,11 @@ export default class IndexedDBCryptoStore {
// attempts to delete the database will block (and subsequent
// attempts to re-create it will also block).
db.onversionchange = (ev) => {
console.log(`versionchange for indexeddb ${this._dbName}: closing`);
db.close();
};
console.log(`connected to indexeddb ${this._dbName}`);
resolve(db);
};
});