How can I stop already scheduled rake task from running scheduler again?

58 views
Skip to first unread message

concept47

unread,
May 7, 2012, 3:16:43 PM5/7/12
to rufus...@googlegroups.com
Whenever I run a rake task with rufus scheduler, it loads the rails environment and of course that loads scheduler again.
This is a problem since I have a bunch of stuff that scheduler kicks off for me as soon as rails is loaded.
The good thing is that the new scheduler thread will die when the rake task is done, but I was wondering if you had any ideas about how I could avoid this behavior.
thanks.

John Mettraux

unread,
May 7, 2012, 4:44:49 PM5/7/12
to rufus...@googlegroups.com
Hello,

what about a variation on:

---8<---
unless defined?(Rake)

$scheduler = ...
$scheduler.every('10s') { puts "hello world" }
end
--->8---

?

Best regards,

--
John Mettraux - http://lambda.io/jmettraux

concept47

unread,
May 8, 2012, 12:05:24 AM5/8/12
to rufus...@googlegroups.com
Thank you so much, had no idea I could do that!
Reply all
Reply to author
Forward
0 new messages