Skip to content

Instantly share code, notes, and snippets.

@softwaregravy
Created June 29, 2011 19:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softwaregravy/1054751 to your computer and use it in GitHub Desktop.
Save softwaregravy/1054751 to your computer and use it in GitHub Desktop.
Always run the job
class JobClass
def perform
begin
#I do stuff here
rescue Exception => e
# catch all exceptions
HoptoadNotifier.notify(e)
ensure
# we want this job to just run continuously, but we don't have an 'auto' way to do that
# so we schedule a new one every time we run
# we can turn this one down more and more as we get more offers
JobClass.new.delay(:run_at => 1.seconds.from_now).perform
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment