summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2024-02-03 20:48:43 +0100
committerHendrik Jäger <gitcommit@henk.geekmail.org>2024-02-03 20:48:48 +0100
commita80fcaab83ff8dda046d3749443db38260327dcc (patch)
tree6e5e224f3c7ecec98349e0a4572215e0aade0539
parent8501b85e09c02f9bd18e8f73453a327ddf7c12e1 (diff)
change retry method to use recursion, raise exception if fails
-rw-r--r--macir.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/macir.rb b/macir.rb
index 8331da4..5c19aca 100644
--- a/macir.rb
+++ b/macir.rb
@@ -185,13 +185,13 @@ def wait_for_challenge_propagation(domain, challenge)
threads.each(&:join)
end
-def acme_request_with_retries
- retries ||= 0
- yield
+def acme_request_with_retries(retries: 5, &block)
+ block.call(self)
rescue Acme::Client::Error::BadNonce
- retries += 1
+ raise unless retries.positive?
+
p 'Retrying because of invalid nonce.'
- retry if retries <= 5
+ acme_request_with_retries(retries - 1, block)
end
def wait_for_challenge_validation(challenge, cert_name)