Last active
August 6, 2021 19:44
-
-
Save jeffkreeftmeijer/d33af629ee014eee80ee4768477e5b38 to your computer and use it in GitHub Desktop.
job.rb
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
loop do | |
retries = 0 | |
begin | |
# TODO fetch and run a job | |
rescue StandardError => error | |
if retries < 10 | |
sleep(retries * 10) | |
retries += 1 | |
retry | |
else | |
# TODO log the exception, then swallow it not to break the loop | |
raise | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment