Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Jobs #33

Closed
jameswyse opened this issue Feb 22, 2014 · 3 comments
Closed

Removing Jobs #33

jameswyse opened this issue Feb 22, 2014 · 3 comments

Comments

@jameswyse
Copy link

I had a look through the documentation and code but couldn't find any way to remove jobs?

I created a task and had it running every 10 seconds but decided I want to call it manually, however it keeps running!

I tried Job#remove as mentioned in #26 but that doesn't exist:

agenda.jobs({name: 'Update Instagram'}, function(err, jobs) {
  if(err) throw err;
  jobs.forEach(function(job) {
    job.remove();
  });
});

[TypeError: Object #<Job> has no method 'remove']

@Albert-IV
Copy link
Collaborator

You can access the mongoSkin connection using agenda._db and call .remove() from there. It does cause some very weird issues if you continue to run agenda.

A better option to remove it out of your DB is to use the mongo shell. Something along these lines:

$ mongo <db-name>
> db.agendaJobs.remove()

This will remove all the agenda jobs defined though. If you only want to remove one, you can query by their name with .remove({"name" : "nameOfJob"}) in the above query.

@Albert-IV
Copy link
Collaborator

You can also use agenda.purge() as well, forgot to mention that.

@rschmukler
Copy link
Collaborator

job.remove now works. Added in b188139. Will be published tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants