lib/oci/object_storage/transfer/multipart/multipart_object_assembler.rb
def make_retrying_call
            @max_attempts.times do |attempt|
              try = attempt + 1
              begin
                return yield
              rescue OCI::Errors::NetworkError # Network errors should be retriable
                raise if try >= @max_attempts # Short-circuit if we're already on our last attempt

                # Use full jitter on networking errors (as hopefully they are short-lived/intermittent)
                sleep(get_full_jitter_sleep_time_millis(attempt) / 1000.0)
              rescue OCI::Errors::ServiceError => e
                raise if try >= @max_attempts # Short-circuit if we're already on our last attempt

                # For internal server errors, use full jitter as it's hopefully intermittent
                sleep(get_full_jitter_sleep_time_millis(attempt) / 1000.0) if e.status >= 500 || e.status == -1

                # For throttles and consistency errors, use equal jitter as this guarantees some sleep time
                # between attempts (full jitter doesn't because we get a value across the range 0 to something, i.e.
                # it is possible to get a very small sleep time)
                if e.status == 429 || (e.status == 409 && e.code == 'ConcurrentObjectUpdate')
                  sleep(get_equal_jitter_sleep_time_millis(attempt) / 1000.0)
                end

                # A non-retriable service error, so just throw it
                raise
              end
            end
          end
# Make a retrying call using a provided block (that we yield to) and return the result of the block
# on success.
Make a retrying call using a provided block (that we yield to) and return the result of the block
on success.
Make a retrying call using a provided block ( that we yield to ) and return the result of the block on success .
def make_retrying_call
            @max_attempts.times do |attempt|
              try = attempt + 1
              begin
                return yield
              rescue OCI::Errors::NetworkError 
                raise if try >= @max_attempts 
                sleep(get_full_jitter_sleep_time_millis(attempt) / 1000.0)
              rescue OCI::Errors::ServiceError => e
                raise if try >= @max_attempts 
                sleep(get_full_jitter_sleep_time_millis(attempt) / 1000.0) if e.status >= 500 || e.status == -1
                if e.status == 429 || (e.status == 409 && e.code == 'ConcurrentObjectUpdate')
                  sleep(get_equal_jitter_sleep_time_millis(attempt) / 1000.0)
                end
                raise
              end
            end
          end
def make_retrying_call @max_attempts . times do | attempt | try = attempt + 1 begin return yield rescue OCI :: Errors :: NetworkError raise if try >= @max_attempts sleep ( get_full_jitter_sleep_time_millis ( attempt ) / 1000.0 ) rescue OCI :: Errors :: ServiceError => e raise if try >= @max_attempts sleep ( get_full_jitter_sleep_time_millis ( attempt ) / 1000.0 ) if e . status >= 500 || e . status == - 1 if e . status == 429 || ( e . status == 409 && e . code == 'ConcurrentObjectUpdate' ) sleep ( get_equal_jitter_sleep_time_millis ( attempt ) / 1000.0 ) end raise end end end
Make a retrying call using a provided block (that we yield to) and return the result of the block
on success.
Make a retrying call using a provided block ( that we yield to ) and return the result of the block on success .
# Network errors should be retriable # Short-circuit if we're already on our last attempt # Use full jitter on networking errors (as hopefully they are short-lived/intermittent) # Short-circuit if we're already on our last attempt # For internal server errors, use full jitter as it's hopefully intermittent # For throttles and consistency errors, use equal jitter as this guarantees some sleep time # between attempts (full jitter doesn't because we get a value across the range 0 to something, i.e. # it is possible to get a very small sleep time) # A non-retriable service error, so just throw it