lostisland/faraday-retry

retry_if is not working?

choosen opened this issue · 2 comments

I've added code:

Faraday.new(url: external_api_data_url), request: { timeout: 5 }) do |conn|
            conn.request :retry, retry_if: ->(env, _exc) { binding.b; env.http_method == :delete }
end.delete(path)

retry_if debugger is not starting.

cat Gemfile.lock | grep farada
    faraday (2.6.0)
      faraday-net_http (>= 2.0, < 3.1)
    faraday-encoding (0.0.5)
      faraday
    faraday-net_http (3.0.1)
    faraday-retry (2.0.0)
      faraday (~> 2.0)
      faraday
  faraday (~> 2.0)
  faraday-encoding
  faraday-retry

Details I checked to see if they were helpful:

A test case for retry_if
https://github.com/lostisland/faraday-retry/blob/main/spec/faraday/retry/middleware_spec.rb#L178

README: a note about methods setting:
https://github.com/lostisland/faraday-retry#specify-a-custom-retry-logic

Going further:

If you write a script, using bundler/inline, you can easily create a reproduce script.

great thanks , I miss info about methods.

@option options [Array] :methods (the idempotent HTTP methods

 #   in IDEMPOTENT_METHODS) A list of HTTP methods to retry without
 #   calling retry_if. Pass an empty Array to call retry_if
#   for all exceptions.