diff options
Diffstat (limited to 'packages/idb-bridge/src/bridge-idb.ts')
-rw-r--r-- | packages/idb-bridge/src/bridge-idb.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/idb-bridge/src/bridge-idb.ts b/packages/idb-bridge/src/bridge-idb.ts index f3749c77c..1f9aa7f4b 100644 --- a/packages/idb-bridge/src/bridge-idb.ts +++ b/packages/idb-bridge/src/bridge-idb.ts @@ -2471,6 +2471,8 @@ export class BridgeIDBTransaction return this._committed || this._aborted; } + _counter = 0; + _openRequest: BridgeIDBOpenDBRequest | null = null; _backendTransaction?: DatabaseTransaction; @@ -2745,7 +2747,14 @@ export class BridgeIDBTransaction // with error handling already built into operation await operation(); } else { - await waitMacroQueue(); + this._counter++; + if (this._counter > 100) { + this._counter = 0; + // Give a chance for macro tasks to do something + // If we don't do this at all, we break WPT tests. + // If we always wait, performance is bad. + await waitMacroQueue(); + } let event; try { |