Re-connecting to cloud redis after losing network connectivity
- Dominant language
- JavaScript
- Stars
- 9.4k
- Forks
- 858
- PR merge metrics
- No merged PRs in 30d
Description
When using a cloud redis connection if the worker / server loses connection to the cloud redis due to a network failure, after the network connection is restored kue is unable to re-connect.
To repro using localhost, I ran the worker code below using node worker.js.
Switched off the network, waited for 1 minute. There are no connection errors thrown.
When we turn on the network connection, jobs go into inactive state. When the worker is restarted kue reconnects to redis and starts processing.
kue version is latest.
```
var kue = require('kue');
var kue_obj;
var redis = "redis://h:pcem1s6h73pqs2fslq8l3tcppvi@ec2-184-73-169-67.compute-1.amazonaws.com:21229";
var kue_obj = kue.createQueue({
prefix: 'q',
redis: redis
});
kue_obj.watchStuckJobs()
console.log("ABS -- Starting Kue Worker");
// On error
kue_obj.on('error', function(err) {
console.log("ABS -- kue_obj couldnt not be created for redis client");
});
// Method to call for findEmail jobs added by server
require('./find_email')(kue_obj);
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the worker.js example, kue.createQueue configuration, and watchStuckJobs behavior, then reproduce the network interruption against the cloud or localhost Redis setup. Done means the worker reconnects after connectivity returns and resumes processing jobs without a restart; inspect find_email usage to verify job handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100