advisory-lock
advisory-lock copied to clipboard
When DSN is missing, lock silently fails
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 DSN it works:
> require('advisory-lock').default('postgresql://localhost/test')('test').tryLock().then(locked => console.log('locked', locked)).catch(console.error)
> locked true
With wrong DSN it fails (as expected):
> require('advisory-lock').default('postgresql://localhost/no_such_db')('test').tryLock().then(locked => console.log('locked', locked)).catch(console.error)
> { error: database "no_such_db" does not exist ...
Expected behaviour
With undefined DSN, an error is thrown.
Oops, could you send a PR?