env.sync() blocks the micro event queue (promise callbacks) in Node when other timeouts are in the queue
kriszyp opened this issue · 0 comments
kriszyp commented
This is a minimal test case to reproduce the issue:
const { Env } = require('node-lmdb');
let env = new Env();
env.open({path: 'test'}); // some path for the db
new Promise(resolve => {
env.sync(() => {
console.log('synced');
resolve();
})
}).then(() => {
// this should execute immediately after it is synced
console.log('then');
});
setTimeout(() => {
console.log('longer timeout');
}, 10000);
Expected output:
synced
then
longer timeout
Actual output:
synced
longer timeout
then