Sha256: 0f758a06b76d41e5505346538b6e60f96549063702073beb5c24c86ed61034b6
Contents?: true
Size: 501 Bytes
Versions: 8
Compression:
Stored size: 501 Bytes
Contents
module VmShepherd module RetryHelper class RetryLimitExceeded < StandardError end RETRY_LIMIT = 10 RETRY_INTERVAL = 60 def retry_until(retry_limit: RETRY_LIMIT, &block) tries = 0 condition_reached = false loop do tries += 1 raise(RetryLimitExceeded) if tries > retry_limit condition_reached = block.call break if condition_reached sleep RETRY_INTERVAL end condition_reached end end end
Version data entries
8 entries across 8 versions & 1 rubygems