Skip to content

Commit

Permalink
Throw if the db is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Feb 11, 2025
1 parent 5485196 commit 8aa8908
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lmdb",
"author": "Kris Zyp",
"version": "3.2.5",
"version": "3.2.6",
"description": "Simple, efficient, scalable, high-performance LMDB interface",
"license": "MIT",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions read.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,15 @@ export function addReadMethods(
},

attemptLock(id, version, callback) {
if (!env.address) throw new Error('Can not operate on a closed database');
keyBytes.dataView.setUint32(0, this.db.dbi);
keyBytes.dataView.setFloat64(4, version);
let keySize = this.writeKey(id, keyBytes, 12);
return attemptLock(env.address, keySize, callback);
},

unlock(id, version, onlyCheck) {
if (!env.address) throw new Error('Can not operate on a closed database');
keyBytes.dataView.setUint32(0, this.db.dbi);
keyBytes.dataView.setFloat64(4, version);
let keySize = this.writeKey(id, keyBytes, 12);
Expand Down

0 comments on commit 8aa8908

Please sign in to comment.