mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 19:26:04 +03:00
rageshake: fix race when collecting logs
*apparently* it's possible for your indexeddb transaction to complete in the background, so that the `oncomplete` handler is never called. Make sure that the oncomplete handler is set *before* doing the work.
This commit is contained in:
parent
15accf33f5
commit
6fd6ea9b8e
1 changed files with 3 additions and 3 deletions
|
@ -205,9 +205,6 @@ class IndexedDBLogStore {
|
|||
}
|
||||
let txn = this.db.transaction(["logs", "logslastmod"], "readwrite");
|
||||
let objStore = txn.objectStore("logs");
|
||||
objStore.add(this._generateLogEntry(lines));
|
||||
let lastModStore = txn.objectStore("logslastmod");
|
||||
lastModStore.put(this._generateLastModifiedTime());
|
||||
txn.oncomplete = (event) => {
|
||||
resolve();
|
||||
};
|
||||
|
@ -219,6 +216,9 @@ class IndexedDBLogStore {
|
|||
new Error("Failed to write logs: " + event.target.errorCode)
|
||||
);
|
||||
}
|
||||
objStore.add(this._generateLogEntry(lines));
|
||||
let lastModStore = txn.objectStore("logslastmod");
|
||||
lastModStore.put(this._generateLastModifiedTime());
|
||||
});
|
||||
return this.flushPromise;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue