Module: JayAPI::Elasticsearch::Mixins::RetriableRequests
Overview
A mixin that allows the including class to retry requests to Elasticsearch by leveraging the Abstract::Connection class’ capabilities.
Constant Summary collapse
- RETRIABLE_ERRORS =
The errors that, if raised, must cause a retry of the connection.
[ ::Elasticsearch::Transport::Transport::ServerError, Faraday::TimeoutError ].freeze
- NON_RETRIABLE_ERRORS =
Subclasses of the
Elasticsearch::Transport::Transport::ServerErrorfor which a retry doesn’t make sense. [ ::Elasticsearch::Transport::Transport::Errors::BadRequest, ::Elasticsearch::Transport::Transport::Errors::Unauthorized, ::Elasticsearch::Transport::Transport::Errors::Forbidden, ::Elasticsearch::Transport::Transport::Errors::NotFound, ::Elasticsearch::Transport::Transport::Errors::MethodNotAllowed, ::Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge, ::Elasticsearch::Transport::Transport::Errors::NotImplemented ].freeze
Instance Method Summary collapse
-
#logger ⇒ Logging::Logger
A logger to log messages.
-
#max_attempts ⇒ Integer
The maximum number of times a request should be retried before giving up.
-
#non_retriable_errors ⇒ Array<Class>
An array of subclasses of the
Elasticsearch::Transport::Transport::ServerErrorfor which a retry doesn’t make sense. -
#retriable_errors ⇒ Array<Class>
The array of errors that, if raised, must cause a retry of the request.
-
#wait_strategy ⇒ JayAPI::Elasticsearch::WaitStrategy
The waiting strategy for retries.
Instance Method Details
#logger ⇒ Logging::Logger
Returns A logger to log messages.
45 46 47 |
# File 'lib/jay_api/elasticsearch/mixins/retriable_requests.rb', line 45 def logger raise_not_implemented(__method__) end |
#max_attempts ⇒ Integer
Returns The maximum number of times a request should be retried before giving up.
34 35 36 |
# File 'lib/jay_api/elasticsearch/mixins/retriable_requests.rb', line 34 def max_attempts raise_not_implemented(__method__) end |
#non_retriable_errors ⇒ Array<Class>
Returns An array of subclasses of the Elasticsearch::Transport::Transport::ServerError for which a retry doesn’t make sense.
58 59 60 |
# File 'lib/jay_api/elasticsearch/mixins/retriable_requests.rb', line 58 def non_retriable_errors NON_RETRIABLE_ERRORS end |
#retriable_errors ⇒ Array<Class>
Returns The array of errors that, if raised, must cause a retry of the request.
51 52 53 |
# File 'lib/jay_api/elasticsearch/mixins/retriable_requests.rb', line 51 def retriable_errors RETRIABLE_ERRORS end |
#wait_strategy ⇒ JayAPI::Elasticsearch::WaitStrategy
Returns The waiting strategy for retries.
40 41 42 |
# File 'lib/jay_api/elasticsearch/mixins/retriable_requests.rb', line 40 def wait_strategy raise_not_implemented(__method__) end |