Skip to content

Instantly share code, notes, and snippets.

@MaryamAdnan3
Created August 6, 2021 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaryamAdnan3/dc1e84674e37aea10e23ceb512e2992e to your computer and use it in GitHub Desktop.
Save MaryamAdnan3/dc1e84674e37aea10e23ceb512e2992e to your computer and use it in GitHub Desktop.
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