v4 can't quit you - async client usage leaving idle connections?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.6k
- Forks
- 2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 40
Description
Maybe I don't understand async/await correctly but can someone help or verify the way to createClient and send commands with async/await that ensures connections actually quit so that all these idle connections aren't made on a recurring script run?
I updated this code from v3 to v4.0.4 and keep getting increasing open(but idle?!) connections that won't go away. (it's on heroku redis if that matters)
near top of module createClient to be used later as a pool connection:
const rclient = require("redis").createClient({
url: process.env.REDIS_TLS_URL,
socket: {
tls: true,
rejectUnauthorized: false
},
legacyMode: true
});
rclient.on('error', (err) => {});
Then later on run a basic SETNX....
(async () => {
try {
await rclient.connect();
await rclient.SETNX(...,function(err, dne) {
if (err) {
console.log('SETNX problem: '+err);
} else if (dne) {
//stuff
}
});
await rclient.quit();
} catch (e) {
console.error(e);
}
})();
I include that await quit() there and expect it to close the connection after command completes..... but I keep getting mounting idle connections? (Why don't they just clear out after expiry time?) I just want to send my command and quit! Any direction or verification that this is the correct usage appreciated
Contributor guide
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 with the v4.0.4 async client lifecycle around createClient(), connect(), SETNX(), and quit(); no files or tests are named in the report. Determine how the callback-based command interacts with await and how recurring scripts should close the client; done means the connection behavior is verified and documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100