A reserved/released ReservedSql prevents the main Sql from ending
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
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!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the minimal JavaScript example and inspect the connection lifecycle behind reserve(), release(), and end(). Done means a released reserved connection no longer prevents sql1.end() from completing without a timeout, with regression coverage for the reported sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgres
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100