Merge pull request #4650 from vector-im/rav/bump_indexeddb_timeot

Increase the timeout for clearing indexeddbs
This commit is contained in:
Richard van der Hoff 2017-07-20 11:50:23 +01:00 committed by GitHub
commit 7e00a86048
2 changed files with 11 additions and 4 deletions

View File

@ -82,9 +82,14 @@ describe('loading:', function () {
// unmounting should have cleared the MatrixClientPeg // unmounting should have cleared the MatrixClientPeg
expect(MatrixClientPeg.get()).toBe(null); expect(MatrixClientPeg.get()).toBe(null);
// chrome seems to take *ages* to delete the indexeddbs.
this.timeout(10000);
// clear the indexeddbs so we can start from a clean slate next time. // clear the indexeddbs so we can start from a clean slate next time.
await test_utils.deleteIndexedDB('matrix-js-sdk:crypto'); await Promise.all([
await test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync'); test_utils.deleteIndexedDB('matrix-js-sdk:crypto'),
test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync'),
]);
console.log(`${Date.now()}: loading: afterEach complete`); console.log(`${Date.now()}: loading: afterEach complete`);
}); });

View File

@ -34,7 +34,8 @@ export function deleteIndexedDB(dbName) {
return; return;
} }
console.log(`${Date.now()}: Removing indexeddb instance: ${dbName}`); const startTime = Date.now();
console.log(`${startTime}: Removing indexeddb instance: ${dbName}`);
const req = window.indexedDB.deleteDatabase(dbName); const req = window.indexedDB.deleteDatabase(dbName);
req.onblocked = () => { req.onblocked = () => {
@ -48,7 +49,8 @@ export function deleteIndexedDB(dbName) {
}; };
req.onsuccess = () => { req.onsuccess = () => {
console.log(`${Date.now()}: Removed indexeddb instance: ${dbName}`); const now = Date.now();
console.log(`${now}: Removed indexeddb instance: ${dbName} in ${now-startTime} ms`);
resolve(); resolve();
}; };
}).catch((e) => { }).catch((e) => {