Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

When DSN is missing, lock silently fails #8

Description

@IlyaSemenov

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions