123456789_123456789_123456789_123456789_123456789_

Module: Mongo::Retryable

Overview

Defines basic behavior around retrying operations.

Since:

  • 2.1.0

Instance Method Summary

Instance Method Details

#read_worker

This method is for internal use only.
Note:

this is only a public method so that tests can add expectations based on it.

Returns the read worker for handling retryable reads.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/retryable.rb', line 65

def read_worker
  @read_worker ||= ReadWorker.new(self)
end

#select_server(cluster, server_selector, session, failed_server = nil, timeout: nil) ⇒ Mongo::Server

This method is for internal use only.

This is a separate method to make it possible for the test suite to assert that server selection is performed during retry attempts.

This is a public method so that it can be accessed via the read and write worker delegates, as needed.

Returns:

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/retryable.rb', line 49

def select_server(cluster, server_selector, session, failed_server = nil, timeout: nil)
  server_selector.select_server(
    cluster,
    nil,
    session,
    deprioritized: [failed_server].compact,
    timeout: timeout
  )
end

#write_worker

This method is for internal use only.
Note:

this is only a public method so that tests can add expectations based on it.

Returns the write worker for handling retryable writes.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/retryable.rb', line 75

def write_worker
  @write_worker ||= WriteWorker.new(self)
end