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.

Calling tryLock() terminates the process on node.js 14 #10

@totenn

Description

@totenn

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(() => {
    console.log("Success!");
  })
  .catch((e) => {
    console.log("Failure!");
  });

Expected: Either "Success!" or "Failure!" is printed to the console.

What actually happens: Nothing is printed. Node process exits with status code 0 when mutex.tryLock is called.

Why is it an issue: Thisworks as expected in node version prior to 14.0.0.

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