Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

akka.pattern.retry tries one too many times #32416

Open
monktastic opened this issue May 10, 2024 · 1 comment
Open

akka.pattern.retry tries one too many times #32416

monktastic opened this issue May 10, 2024 · 1 comment

Comments

@monktastic
Copy link

akka.pattern.retry takes a param called attempts, but it tries attempts+1 times. Simplified version of RetrySupport.retry:

    if (maxAttempts - attempted > 0) {
      val result = tryAttempt()
      retry(attempt, maxAttempts, delayFunction, attempted + 1)
    } else {
      tryAttempt()
    }
  }

If maxAttempts=0 and attempted=0, it will still try. If maxAttempts=1 it will try twice. And so on.

@johanandren
Copy link
Member

It is not really attempts but rather maxRetries (the first call isn't a retry). Not sure it is worth changing though, parameter names are part of method signature on the Scala side. Maybe worth spelling out in the API docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants