Class: Mongo::Retryable::BaseWorker Private
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
Mongo::Retryable::ReadWorker, Mongo::Retryable::WriteWorker
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable
|
|
Inherits: | Object |
Defined in: | lib/mongo/retryable/base_worker.rb |
Overview
The abstract superclass for workers employed by ::Mongo::Retryable
.
Class Method Summary
-
.new(retryable) ⇒ BaseWorker
constructor
Internal use only
Constructs a new worker.
Instance Attribute Summary
- #retryable ⇒ Mongo::Retryable readonly Internal use only
Instance Method Summary
-
#deprecation_warning(key, warning)
private
Internal use only
Logs the given deprecation warning the first time it is called for a given key; after that, it does nothing when given the same key.
-
#is_legacy_retryable_exception?(e) ⇒ true | false
private
Internal use only
Tests to see if the given exception instance is of a type that can be retried with legacy retry mechanism.
-
#is_retryable_exception?(e) ⇒ true | false
private
Internal use only
Tests to see if the given exception instance is of a type that can be retried with modern retry mechanism.
-
#legacy_retryable_exceptions ⇒ Array<Mongo:Error>
private
Internal use only
Indicate which exception classes that are generally retryable when using legacy retries mechanism.
-
#log_retry(e, options = nil)
private
Internal use only
Log a warning so that any application slow down is immediately obvious.
-
#retryable_exceptions ⇒ Array<Mongo:Error>
private
Internal use only
Indicate which exception classes that are generally retryable when using modern retries mechanism.
Instance Attribute Details
#retryable ⇒ Mongo::Retryable (readonly)
# File 'lib/mongo/retryable/base_worker.rb', line 34
attr_reader :retryable
Instance Method Details
#deprecation_warning(key, warning) (private)
Logs the given deprecation warning the first time it is called for a given key; after that, it does nothing when given the same key.
#is_legacy_retryable_exception?(e) ⇒ true
| false
(private)
Tests to see if the given exception instance is of a type that can be retried with legacy retry mechanism.
# File 'lib/mongo/retryable/base_worker.rb', line 95
def is_legacy_retryable_exception?(e) legacy_retryable_exceptions.any? { |klass| klass === e } end
#is_retryable_exception?(e) ⇒ true
| false
(private)
Tests to see if the given exception instance is of a type that can be retried with modern retry mechanism.
# File 'lib/mongo/retryable/base_worker.rb', line 87
def is_retryable_exception?(e) retryable_exceptions.any? { |klass| klass === e } end
#legacy_retryable_exceptions ⇒ Array
<Mongo:Error
> (private)
Indicate which exception classes that are generally retryable when using legacy retries mechanism.
# File 'lib/mongo/retryable/base_worker.rb', line 71
def legacy_retryable_exceptions [ Error::ConnectionPerished, Error::ServerNotUsable, Error::SocketError, Error::SocketTimeoutError, Error::PoolClearedError, Error::PoolPausedError, ].freeze end
#log_retry(e, options = nil) (private)
Log a warning so that any application slow down is immediately obvious.
#retryable_exceptions ⇒ Array
<Mongo:Error
> (private)
Indicate which exception classes that are generally retryable when using modern retries mechanism.
# File 'lib/mongo/retryable/base_worker.rb', line 57
def retryable_exceptions [ Error::ConnectionPerished, Error::ServerNotUsable, Error::SocketError, Error::SocketTimeoutError, ].freeze end