Skip to content

Instantly share code, notes, and snippets.

@ericwoodruff
Created December 12, 2013 16:06
Show Gist options
  • Save ericwoodruff/7930465 to your computer and use it in GitHub Desktop.
Save ericwoodruff/7930465 to your computer and use it in GitHub Desktop.
Ruby rescue_wait sleep retry
def rescue_wait(timeout, increment = 2)
start = Time.now
begin
yield
return true
rescue Exception => e
puts e.message
sleep increment
retry unless Time.now-start > timeout
end
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment