Module: Magellan::Cli::Ssl
- Defined in:
- lib/magellan/cli/ssl.rb
Constant Summary collapse
- DEFAULT_MAX_RETRY_COUNT =
(ENV["MAGELLAN_CLI_MAX_RETRY_COUNT"] || 10).to_i
Class Method Summary collapse
-
.retry_on_ssl_error(name, options = {}) ⇒ Object
SSLエラー発生時に規定の回数までリトライします.
Class Method Details
.retry_on_ssl_error(name, options = {}) ⇒ Object
SSLエラー発生時に規定の回数までリトライします
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/magellan/cli/ssl.rb', line 17 def retry_on_ssl_error(name, = {}) max_retry_count = ([:max_retry_count] || DEFAULT_MAX_RETRY_COUNT).to_i interval = [:interval] || 0.2 retry_count = 0 begin return yield rescue OpenSSL::SSL::SSLError => e $stderr.puts("retrying #{name} [#{e.class.name}] #{e.message}") sleep(interval) retry_count += 1 retry if retry_count <= max_retry_count raise e end end |