padolsey / cron.js

Cron for JavaScript. Still in development.
123 stars 22 forks source link

Clear cron job #4

Open ghost opened 9 years ago

ghost commented 9 years ago

Hello. I need to delete cronJob object. How can i do it?

knguyen2525 commented 9 years ago

I also need to do this.

ghost commented 9 years ago

I have create it from forked current cron.js. You can use it:https://github.com/farkhad-alizade/cron.js

knguyen2525 commented 9 years ago

Thanks so much!

How would I stop it?

var job = new CronJob('/10 * * * * ', function(){ console.log("please stop me"); });

I tried job.stop();

Thanks again

On Thu, Apr 30, 2015 at 11:26 PM, farkhad-alizade notifications@github.com wrote:

I have create it from forked current cron.js. You can use it: https://github.com/farkhad-alizade/cron.js

— Reply to this email directly or view it on GitHub https://github.com/padolsey/cron.js/issues/4#issuecomment-98057662.

ghost commented 9 years ago

just call stop method. job.stop(); Exactly!

knguyen2525 commented 9 years ago

Hmmm, getting a job.stop is not a function.

var job = new CronJob('/10 * * * * ', function(){ console.log("running"); job.stop(); });

Any ideas :(

ghost commented 9 years ago

are you sure u forked cron.js from my repository , not from @padolsey ?

knguyen2525 commented 9 years ago

yes, I also ran through the cron.js code to make sure it had the stop logic.

ghost commented 9 years ago

Please, try this: var job = new CronJob('/10 * * * * ', function(){ console.log("running"); }); job.stop();

knguyen2525 commented 9 years ago

Same issue, BUT I just manually set job.events = [] and job.isStopped = true and that did the trick!

Cheers!