Open larsw opened 1 year ago
import { open } from 'lmdb'; // or require
let myDB = open({
path: 'my-db',
});
await myDB.put('greeting', { someText: 'Hello, World!' });
console.log(myDB.get('greeting').someText)
await myDB.transaction(() => {
myDB.put('greeting', { someText: 'Hello, World!' });
myDB.get('greeting').someText // 'Hello, World!'
console.log('Hello, World! in tx');
});
Seems like the non-transactional code works, but not the put/get happening in a transaction.
Asynchronous transaction callbacks require threadsafe calls, and I believe that has not been fully implemented (correctly) in Bun: https://github.com/oven-sh/bun/issues/158#issuecomment-1126624085
Note that you can still execute multiple puts in the same event turn or same batch and they will be transactionally committed together, it is the async transaction callback that can't function without the NAPI threadsafe call system.
Hi,
I'm trying to use lmdb-js with bun (1.0.7) but it just hangs (as far as I can see, it's able to create/open the database, but not doing put/get with or without a transaction.
Is there any way I can try to diagnose this further?