ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir
https://hex.pm/packages/ex_aws
MIT License
1.26k stars 521 forks source link

Retry cycle is performed one attempt less than expected #913

Open ironaimer opened 1 year ago

ironaimer commented 1 year ago

Environment

Current behavior

In case of SQS unavailability retry cycle is executed one iteration less than expected.

It seems strict ">" should be used in attempt_again? in request.ex as "attempt" starts from 1.

  def attempt_again?(attempt, reason, config) do
    if attempt >= config[:retries][:max_attempts] do

So retry cycle is executed (max_attempts - 1) times.

Expected behavior

Retry cycle should be executed max_attempts times.

bernardd commented 1 year ago

I may be wrong, but that's not how I read it: