module Mongo::Error::ReadWriteRetryable
A module encapsulating functionality to indicate whether errors are retryable.
@note Although methods of this module are part of the public API,
the fact that these methods are defined on this module and not on the classes which include this module is not part of the public API.
@api semipublic
Constants
- RETRY_MESSAGES
These are magic error messages that could indicate a cluster reconfiguration behind a mongos.
@api private
- WRITE_RETRY_ERRORS
Error codes and code names that should result in a failing write being retried.
@api private
- WRITE_RETRY_MESSAGES
These are magic error messages that could indicate a master change.
@api private
Public Instance Methods
Whether the error is a retryable error according to the legacy read retry logic.
@return [ true, false ]
@deprecated
# File lib/mongo/error/read_write_retryable.rb, line 80 def retryable? write_retryable? || code.nil? && RETRY_MESSAGES.any?{ |m| message.include?(m) } end
Whether the error is a retryable error according to the modern retryable reads and retryable writes specifications.
This method is also used by the legacy retryable write logic to determine whether an error is a retryable one.
@return [ true, false ]
# File lib/mongo/error/read_write_retryable.rb, line 92 def write_retryable? write_retryable_code? || code.nil? && WRITE_RETRY_MESSAGES.any? { |m| message.include?(m) } end
Private Instance Methods
# File lib/mongo/error/read_write_retryable.rb, line 97 def write_retryable_code? if code WRITE_RETRY_ERRORS.any? { |e| e[:code] == code } else # return false rather than nil false end end