Skip to content

Commit

Permalink
Use correct ArrayBuffer for committed event
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed May 22, 2024
1 parent 07708b0 commit 0b58a4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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.0.9",
"version": "3.0.10",
"description": "Simple, efficient, scalable, high-performance LMDB interface",
"license": "MIT",
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,13 @@ describe('lmdb-js', function () {
shared_buffer.notify();
});
});
it('committed event', async function () {
await new Promise((resolve) => {
db.put(5, { name: 'test committed event' });
db.on('committed', resolve);
});
});

it('prefetch', async function () {
await new Promise((resolve) => db.prefetch(['key1', 'key2'], resolve));
let key = '';
Expand Down
2 changes: 1 addition & 1 deletion write.js
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ export function addWriteMethods(
beforeCommitCallbacks.push(callback);
} else if (event == 'aftercommit') afterCommitCallbacks.push(callback);
else if (event == 'committed') {
this.getUserSharedBuffer('__committed__', Buffer.from([]), {
this.getUserSharedBuffer('__committed__', new ArrayBuffer(0), {
envKey: true,
callback,
});
Expand Down

0 comments on commit 0b58a4b

Please sign in to comment.