i started to use kue/node.js . I checked a tutorial and it had this code
var kue = require('kue')
, queue = kue.createQueue();
function newJob (){
var job = queue.create('new_job');
job.save();
}
queue.process('new_job', function (job, done){
console.log('Job', job.id, 'is done');
done && done();
})
setInterval(newJob, 3000);
So When i run this from my terminal - node test.js , i will output "job { job id } is done" every 3 seconds .
Now i changed the code to following
var kue = require('kue')
, queue = kue.createQueue();
var job = queue.create('new_job');
job.save();
queue.process('new_job', function (job, done){
console.log('Job', job.id, 'is done');
done && done();
})
I removed the newJob function and the setInterval , I expected the code would run once , because i create the queue and save the job first and then i will process it below . but when i run the code from terminal nothing happens , no output .
Why i am not getting my expected result ? what is the logic behind this . please explain . thanks in advance .