rufus-scheduler 1.0.12 released
Just released version 1.0.12 of the rufus-scheduler gem.
It contains a few improvements, like a more generic find_jobs() methods, but the main new feature is the :timeout attribute, which, when present, limits the time allocated for a triggered job.
require 'rubygems' require 'rufus/scheduler' # sudo gem install rufus-scheduler s = Rufus::Scheduler.start_new s.every "10h30m", :timeout => "3h" do do_that_long_job() end
Every 10 hours and 30 minutes the ‘long job’ will get triggered, if after 3 hours it isn’t done, it will get interrupted via a Rufus::TimeOutError.
Previously, users were wrapping the job inside a ‘Timeout’ construct which used a second thread. The :timeout attribute simply schedules a rufus job for the expiration, leveraging its own infrastructure.
Thanks to Xianhang Zhang, K Liu and Tim Uckun for their feedback.
rufus : http://rufus.rubyforge.org
the scheduler : http://rufus.rubyforge.org/rufus-scheduler
source : http://github.com/jmettraux/rufus-scheduler
mailing list : http://groups.google.com/group/rufus-ruby