Created
June 29, 2011 19:51
-
-
Save softwaregravy/1054751 to your computer and use it in GitHub Desktop.
Always run the job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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