Skip to content

Instantly share code, notes, and snippets.

@idealhack
Last active December 14, 2017 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idealhack/98bb6e3f0a5e71b39a77 to your computer and use it in GitHub Desktop.
Save idealhack/98bb6e3f0a5e71b39a77 to your computer and use it in GitHub Desktop.
Reset active kue jobs to inactive state
var redis = require ('redis'),
kue = require ('kue'),
redisClient = redis.createClient(6379, "127.0.0.1");
kue.redis.createClient = function () {
return redisClient;
};
kue.app.listen(7000);
kue.Job.rangeByType ('notification', 'active', 0, 10, 'asc', function (err, selectedJobs) {
console.log(selectedJobs)
selectedJobs.forEach(function (job) {
job.state('inactive').save();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment