Skip to content

Commit

Permalink
Add Retry Logic to GET requests for ServerBrokeConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbest committed Oct 31, 2024
1 parent 247c1ba commit 630a528
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def http_get(url, headers, max_retries = 5, verify_ssl = true)
log_exception(e)
rescue RestClient::ServerBrokeConnection => e
log_exception(e)
if retries < max_retries
retries += 1
print "Retrying!"
sleep(15)
retry
rescue RestClient::ExceptionWithResponse => e
log_exception(e)
if retries < max_retries
Expand Down

0 comments on commit 630a528

Please sign in to comment.