From 16c23010412dcc6d2181ba6cb2735522db3401af Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 10 Jun 2020 11:59:39 +0100 Subject: [PATCH] chore: process queries in own tx --- src/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.js b/src/index.js index 3546d39..a47f8c7 100644 --- a/src/index.js +++ b/src/index.js @@ -106,6 +106,10 @@ class IdbDatastore extends Adapter { } async * _queryIt (q) { + if (this._tx) { + await this._tx.done + } + const range = q.prefix ? self.IDBKeyRange.bound(str2ab(q.prefix), str2ab(q.prefix + '\xFF'), false, true) : undefined const store = this._getStore() let cursor = await store.openCursor(range) @@ -131,6 +135,8 @@ class IdbDatastore extends Adapter { } cursor = await cursor.continue() } + + await this._tx.done } async open () {