Skip to content

Instantly share code, notes, and snippets.

@jmettraux
Created January 5, 2009 23:41
Show Gist options
  • Save jmettraux/43583 to your computer and use it in GitHub Desktop.
Save jmettraux/43583 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rufus/scheduler'
s = Rufus::Scheduler.start_new
def long_job
puts "#{Time.now} processing"
sleep 6
rescue
puts "#{Time.now} error"
end
s.every '3s', :timeout => '2s' do
long_job
end
s.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment