Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
chore: process queries in own tx
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Jun 10, 2020
1 parent e43eda4 commit 16c2301
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -131,6 +135,8 @@ class IdbDatastore extends Adapter {
}
cursor = await cursor.continue()
}

await this._tx.done
}

async open () {
Expand Down

0 comments on commit 16c2301

Please sign in to comment.