You've already forked matrix-js-sdk
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:
@@ -96,6 +96,7 @@ export default class OutgoingRoomKeyRequestManager {
|
|||||||
* Called when the client is stopped. Stops any running background processes.
|
* Called when the client is stopped. Stops any running background processes.
|
||||||
*/
|
*/
|
||||||
stop() {
|
stop() {
|
||||||
|
console.log('stopping OutgoingRoomKeyRequestManager');
|
||||||
// stop the timer on the next run
|
// stop the timer on the next run
|
||||||
this._clientRunning = false;
|
this._clientRunning = false;
|
||||||
}
|
}
|
||||||
@@ -229,6 +230,12 @@ export default class OutgoingRoomKeyRequestManager {
|
|||||||
|
|
||||||
this._sendOutgoingRoomKeyRequests().finally(() => {
|
this._sendOutgoingRoomKeyRequests().finally(() => {
|
||||||
this._sendOutgoingRoomKeyRequestsRunning = false;
|
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();
|
}).done();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,11 @@ export default class IndexedDBCryptoStore {
|
|||||||
// attempts to delete the database will block (and subsequent
|
// attempts to delete the database will block (and subsequent
|
||||||
// attempts to re-create it will also block).
|
// attempts to re-create it will also block).
|
||||||
db.onversionchange = (ev) => {
|
db.onversionchange = (ev) => {
|
||||||
|
console.log(`versionchange for indexeddb ${this._dbName}: closing`);
|
||||||
db.close();
|
db.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(`connected to indexeddb ${this._dbName}`);
|
||||||
resolve(db);
|
resolve(db);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user