From 247c1bad2ea01ef4dc63653feacf58f6e2160a28 Mon Sep 17 00:00:00 2001 From: Erica <41438524+netplwiz@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:02:05 -0500 Subject: [PATCH 1/3] Update http.rb Add retry to ServerBrokeConnection --- lib/http.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/http.rb b/lib/http.rb index 4e820c4d..96b5ebde 100644 --- a/lib/http.rb +++ b/lib/http.rb @@ -103,6 +103,12 @@ def http_post(url, headers, payload, max_retries = 5, verify_ssl = true) end rescue RestClient::ServerBrokeConnection => e log_exception(e) + if retries < max_retries + retries += 1 + print "Retrying!" + sleep(15) + retry + end rescue RestClient::ExceptionWithResponse => e log_exception(e) if retries < max_retries From 630a5287c59654b5d0e32c936e47ab109ce3e3d1 Mon Sep 17 00:00:00 2001 From: alexbest Date: Thu, 31 Oct 2024 15:11:28 -0500 Subject: [PATCH 2/3] Add Retry Logic to GET requests for ServerBrokeConnection --- lib/http.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/http.rb b/lib/http.rb index 96b5ebde..5068d7bd 100644 --- a/lib/http.rb +++ b/lib/http.rb @@ -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 From 0e68f70e0bd0318ec5dbdfabcd61603d0fbb8b61 Mon Sep 17 00:00:00 2001 From: Jason Garber <122489457+jgarber-cisco@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:47:30 +0000 Subject: [PATCH 3/3] Add missing `end` --- lib/http.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/http.rb b/lib/http.rb index 5068d7bd..51b9d655 100644 --- a/lib/http.rb +++ b/lib/http.rb @@ -44,6 +44,7 @@ def http_get(url, headers, max_retries = 5, verify_ssl = true) print "Retrying!" sleep(15) retry + end rescue RestClient::ExceptionWithResponse => e log_exception(e) if retries < max_retries