advisory-lock
advisory-lock copied to clipboard
Distributed locking using PostgreSQL advisory locks (Node.js)
**Versions:** node 14.2.0 advisory-lock 1.1.1 **Code:** ``` const advisoryLock = require("advisory-lock").default; const databaseUri = "postgres://db_user:db_password@localhost:5432/postgres" async function lock() { const mutex = advisoryLock(databaseUri)("testLock"); await mutex.tryLock(); } lock() .then(() => {...
Hi, I've read the code and noticed the following comment: // TODO: detect "in process" collisions? Can you explain if its relevant so I can create PR to fix it?...
If DSN is not provided at all (e.g. because of the misconfigured environment), advisory-lock silently fails to lock: ``` > require('advisory-lock').default()('test').tryLock().then(locked => console.log('locked', locked)).catch(console.error) > locked false ``` With proper...
In the README, `lockShared` and `unlockShared` are documented but aren't exposed on the mutex object returned from the mutex creator factory.