Sha256: 142e7367d891cf3a79f28fa16643f779dc194ab8e35ad35625c118876a308c47
Contents?: true
Size: 685 Bytes
Versions: 18
Compression:
Stored size: 685 Bytes
Contents
module Gitlab module Triage module Retryable MAX_RETRIES = 3 BACK_OFF_SECONDS = 10 attr_accessor :tries def execute_with_retry(exception_types: [StandardError], backoff_exceptions: []) @tries = 0 until maximum_retries_reached? begin @tries += 1 return yield rescue *exception_types raise if maximum_retries_reached? rescue *backoff_exceptions raise if maximum_retries_reached? sleep(BACK_OFF_SECONDS) end end end private def maximum_retries_reached? tries == MAX_RETRIES end end end end
Version data entries
18 entries across 18 versions & 2 rubygems