Skip to content

Commit 8377bfb

Browse files
Fix IDBBatchAtomicVFS use of completed transaction.
1 parent 7a14d78 commit 8377bfb

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/examples/IDBBatchAtomicVFS.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { FacadeVFS } from '../FacadeVFS.js';
33
import * as VFS from '../VFS.js';
44
import { WebLocksMixin } from '../WebLocksMixin.js';
55

6+
const RETRYABLE_ERRORS = new Set([
7+
'TransactionInactiveError',
8+
'InvalidStateError'
9+
]);
10+
611
/**
712
* @typedef Metadata
813
* @property {string} name
@@ -717,21 +722,21 @@ export class IDBContext {
717722
});
718723
}
719724

720-
// @ts-ignore
721-
// Create object store proxies.
722-
const objectStores = [...tx.objectStoreNames].map(name => {
723-
return [name, this.proxyStoreOrIndex(tx.objectStore(name))];
724-
});
725-
726725
try {
726+
// @ts-ignore
727+
// Create object store proxies.
728+
const objectStores = [...tx.objectStoreNames].map(name => {
729+
return [name, this.proxyStoreOrIndex(tx.objectStore(name))];
730+
});
731+
727732
// Execute the function.
728733
return await f(Object.fromEntries(objectStores));
729734
} catch (e) {
730735
// Use a new transaction if this one was inactive. This will
731736
// happen if the last request in the transaction completed
732737
// in a previous task but the transaction has not yet committed.
733-
if (!i && e.name === 'TransactionInactiveError') {
734-
this.log?.('TransactionInactiveError, retrying');
738+
if (!i && RETRYABLE_ERRORS.has(e.name)) {
739+
this.log?.(`${e.name}, retrying`);
735740
tx = null;
736741
continue;
737742
}

web-test-runner.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
88
defaultTimeoutInterval: 5 * 60 * 1000
99
},
1010
},
11+
browserLogs: true,
12+
browserStartTimeout: 60_000,
1113
nodeResolve: true,
1214
files: ['./test/*.test.js'],
1315
concurrency: 1,
16+
concurrentBrowsers: 1,
1417
browsers: [
1518
chromeLauncher({
1619
launchOptions: {

0 commit comments

Comments
 (0)