Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
totenn opened this issue May 19, 2020 · 2 comments
Open

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

totenn opened this issue May 19, 2020 · 2 comments

Comments

@totenn
Copy link

totenn commented May 19, 2020

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.

@stasgm
Copy link

stasgm commented Nov 3, 2022

It helped me,
Just add this to package.json

      "overrides": {
		"advisory-lock": {
			"pg": "8.7.3"
		}
	}

@olalonde
Copy link
Contributor

Hi, just letting you know I moved the repo to https://github.com/binded/advisory-lock and fixing bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants