Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
overriding retry middleware of existing faraday connection object
def initialize(timeout:, max_retries:, retry_interval:,
backoff_factor:, retry_statuses:, retry_methods:,
http_client_instance: nil,
override_http_client_configiration: false,
cache: false, verify: true)
@connection = http_client_instance.instance_variable_get('@connection')
if override_http_client_configiration
@builder = @connection.instance_variable_get('@builder')
@builder.instance_variable_get('@handlers').delete('Faraday::Request::Retry')
@connection.request :retry, max: max_retries, interval: retry_interval,
backoff_factor: backoff_factor,
retry_statuses: retry_statuses,
methods: retry_methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment