I am usinh kue for scheduling jobs that run at specific intervlas like
daily, weekly, monthly etc...
Also from the ui when a campaign is created , a job is created and pushed
to the kue.
Now my problem is whenever there is a problem with redis connection, the
functions like kue.create, kue.get, kue.delete never return error and are
somehow lost forever,
I have no way of telling the user, "hey, there is some technical problem.
the campaign could not be scheduled".
Here is a part of my code.. The one i am talking about is the part of code
that says 'Job Creation failed' .. if there is a problem with redis
connection, the save() function never calls back and my promise keeps
hanging.. neither resolved nor rejected
var campaignObj = {
title: row.title,
id: row.id,
emailList: campaignJSON.emailList,
clientId: row.clientId,
emailText: step.emailText,
startDate: campaignJSON.startDate,
endDate: campaignJSON.endDate,
stepIndex: idx,
type: 'delay'
};
var newJobStep;
console.log('the step is', step);
if ([undefined, null, 'null'].indexOf(step.jobId) !== -1) {
//newly added delay campaign
//schedule the step
newJobStep = jobQueue.create('campaign-jobs',
campaignObj).delay(stepDelay).removeOnComplete(true)
.save(function(err) {
if (err) {
console.log('Job creation failed');
if (idx === campaignJSON.steps.length - 1) {
defered.reject('Error creating the job for the step ',
idx + 1);
}
} else {
step.jobId = newJobStep.id;
console.log('saving json', campaignJSON.steps[idx]);
self.saveCampaignJSON(campaignJSON, row.id);
if (idx === campaignJSON.steps.length - 1) {
defered.resolve();
}
}
});
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/0c589a6a-9465-45d8-a660-150a11fe27e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.