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

A reserved/released ReservedSql prevents the main Sql from ending #925

Open
jamesgpearce opened this issue Aug 7, 2024 · 0 comments
Open

Comments

@jamesgpearce
Copy link

Awesome library! Thanks so far. I have a small issue though... this works fine:

const sql1 = postgres(process.env.DATABASE_URL);
await sql1.end();

But this hangs indefinitely:

const sql1 = postgres(process.env.DATABASE_URL);

  const sql2 = await sql1.reserve();
  sql2.release();

await sql1.end(); // never completes

Once I have reserved/released a ReservedSql connection, the only way I can end the whole thing cleanly is to add a timeout with await sql1.end({timeout: 0.1});.

By the way, I notice that the .release method doesn't seem asynchronous, even though the example in the readme has an await. That doesn't fix this issue though.

Is this expected? Thanks!

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

1 participant