Skip to content

Instantly share code, notes, and snippets.

@Bersam
Last active October 5, 2016 07:08
Show Gist options
  • Save Bersam/c46148decf0acf4b8544a66f13f11bcd to your computer and use it in GitHub Desktop.
Save Bersam/c46148decf0acf4b8544a66f13f11bcd to your computer and use it in GitHub Desktop.

Revisions

  1. Bersam renamed this gist Oct 5, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Bersam created this gist Aug 12, 2016.
    25 changes: 25 additions & 0 deletions cleanQueus.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    var clean = function(self){
    return self.pause()
    .then(function() {
    log.info(self.data.username + " is paused.");
    self.toFollow.on('cleaned', function(job, type) {
    console.log('Cleaned %s %s jobs', job.length, type);
    });
    return self.toFollow.clean(0, 'completed');
    })
    .then(function() {
    self.toUnfollow.on('cleaned', function(job, type) {
    console.log('Cleaned %s %s jobs', job.length, type);
    });
    return self.toUnfollow.clean(0, 'completed');
    })
    .then(function() {
    self.toSeekQ.on('cleaned', function(job, type) {
    console.log('Cleaned %s %s jobs', job.length, type);
    });
    return self.toSeekQ.clean(0, 'completed');
    })
    .then(function() {
    return self.resume();
    })
    }