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
ensure indexeddb workers are never double-connected
This commit is contained in:
@@ -101,6 +101,7 @@ const LocalIndexedDBStoreBackend = function LocalIndexedDBStoreBackend(
|
||||
this.indexedDB = indexedDBInterface;
|
||||
this._dbName = "matrix-js-sdk:" + (dbName || "default");
|
||||
this.db = null;
|
||||
this._disconnected = true;
|
||||
this._syncAccumulator = new SyncAccumulator();
|
||||
};
|
||||
|
||||
@@ -112,13 +113,15 @@ LocalIndexedDBStoreBackend.prototype = {
|
||||
* @return {Promise} Resolves if successfully connected.
|
||||
*/
|
||||
connect: function() {
|
||||
if (this.db) {
|
||||
if (!this._disconnected) {
|
||||
console.log(
|
||||
`LocalIndexedDBStoreBackend.connect: already connected`,
|
||||
`LocalIndexedDBStoreBackend.connect: already connected or connecting`,
|
||||
);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
this._disconnected = false;
|
||||
|
||||
console.log(
|
||||
`LocalIndexedDBStoreBackend.connect: connecting`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user