module Mongo::Collection::View::ChangeStream::Retryable
Behavior around resuming a change stream.
@since 2.5.0
Constants
- RETRY_MESSAGES
Private Instance Methods
network_error?(error)
click to toggle source
# File lib/mongo/collection/view/change_stream/retryable.rb, line 46 def network_error?(error) [ Error::SocketError, Error::SocketTimeoutError].include?(error.class) end
read_with_one_retry() { || ... }
click to toggle source
# File lib/mongo/collection/view/change_stream/retryable.rb, line 32 def read_with_one_retry yield rescue => e if retryable?(e) yield else raise(e) end end
retryable?(error)
click to toggle source
# File lib/mongo/collection/view/change_stream/retryable.rb, line 42 def retryable?(error) network_error?(error) || retryable_operation_failure?(error) end
retryable_operation_failure?(error)
click to toggle source
# File lib/mongo/collection/view/change_stream/retryable.rb, line 50 def retryable_operation_failure?(error) error.is_a?(Error::OperationFailure) && RETRY_MESSAGES.any? { |m| error.message.include?(m) } end