From 631a16bdc3cd8c82125b0f33124dc663dc7ae7e5 Mon Sep 17 00:00:00 2001 From: George Ganchev <42203630+naft-a@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:56:02 +0300 Subject: [PATCH] chore: add retries to openssl errors in reading (#5) --- lib/deploy_agent/agent.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/deploy_agent/agent.rb b/lib/deploy_agent/agent.rb index 9889fa0..2ef672f 100644 --- a/lib/deploy_agent/agent.rb +++ b/lib/deploy_agent/agent.rb @@ -7,6 +7,7 @@ module DeployAgent class Agent def initialize(options = {}) + @retries = 0 @options = options end @@ -24,6 +25,16 @@ def run monitor.value.tx_data if monitor.writeable? end timers.fire + + @retries = 0 + end + rescue OpenSSL::SSL::SSLError => e + @retries += 1 + + if @retries == 4 + raise e + else + retry end rescue ServerConnection::ServerDisconnected retry