Created
December 28, 2011 08:47
-
-
Save codesnik/1527149 to your computer and use it in GitHub Desktop.
how to make several retries
This file contains hidden or 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
def foo | |
puts "trying!" | |
do_something_exceptional | |
rescue RetriableException | |
retries ||= 5 | |
retries -= 1 | |
raise if retries.zero? | |
retry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment