lib/mongo/retryable.rb
def legacy_write_with_retry(server = nil, session = nil)
      # This is the pre-session retry logic, and is not subject to
      # current retryable write specifications.
      # In particular it does not retry on SocketError and SocketTimeoutError.
      attempt = 0
      begin
        attempt += 1
        server ||= select_server(cluster, ServerSelector.primary, session)
        yield server
      rescue Error::OperationFailure => e
        e.add_note('legacy retry')
        e.add_note("attempt #{attempt}")
        server = nil
        if attempt > client.max_write_retries
          raise e
        end
        if e.label?('RetryableWriteError')
          log_retry(e, message: 'Legacy write retry')
          cluster.scan!(false)
          retry
        else
          raise e
        end
      end
    end
# Implements legacy write retrying functionality by yielding to the passed
# block one or more times.
#
# This method is used for operations which are not supported by modern
# retryable writes, such as delete_many and update_many.
#
# @param [ Server ] server The server which should be used for the
#   operation. If not provided, the current primary will be retrieved from
#   the cluster.
# @param [ nil | Session ] session Optional session to use with the operation.
#
# @yieldparam [ Server ] server The server to which the write should be sent.
#
# @api private
Implements legacy write retrying functionality by yielding to the passed
block one or more times.

This method is used for operations which are not supported by modern
retryable writes, such as delete_many and update_many.
Implements legacy write retrying functionality by yielding to the passed block one or more times . This method is used for operations which are not supported by modern retryable writes such as delete_many and update_many .
def legacy_write_with_retry(server = nil, session = nil)
      attempt = 0
      begin
        attempt += 1
        server ||= select_server(cluster, ServerSelector.primary, session)
        yield server
      rescue Error::OperationFailure => e
        e.add_note('legacy retry')
        e.add_note("attempt #{attempt}")
        server = nil
        if attempt > client.max_write_retries
          raise e
        end
        if e.label?('RetryableWriteError')
          log_retry(e, message: 'Legacy write retry')
          cluster.scan!(false)
          retry
        else
          raise e
        end
      end
    end
def legacy_write_with_retry ( server = nil , session = nil ) attempt = 0 begin attempt += 1 server ||= select_server ( cluster , ServerSelector . primary , session ) yield server rescue Error :: OperationFailure => e e . add_note ( 'legacy retry' ) e . add_note ( "attempt #{attempt}" ) server = nil if attempt > client . max_write_retries raise e end if e . label? ( 'RetryableWriteError' ) log_retry ( e , message : 'Legacy write retry' ) cluster . scan! ( false ) retry else raise e end end end
Implements legacy write retrying functionality by yielding to the passed
block one or more times.
Implements legacy write retrying functionality by yielding to the passed block one or more times .
# This is the pre-session retry logic, and is not subject to # current retryable write specifications. # In particular it does not retry on SocketError and SocketTimeoutError.
server
session
server The server to which the write should be sent.
server The server to which the write should be sent .
api
None