Sha256: 7747f55f3b399dddefc613a7ad348711941d4792a5dd48a0ea760cacbcbc2f24
Contents?: true
Size: 485 Bytes
Versions: 12
Compression:
Stored size: 485 Bytes
Contents
module VmShepherd module RetryHelper class RetryLimitExceeded < StandardError end RETRY_LIMIT = 60 RETRY_INTERVAL = 5 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
12 entries across 12 versions & 1 rubygems