Skip to content

Retry is making an extra attempt #31

Description

@redkhalil

I'm not sure why but I'm getting an extra call to my promise
Looks like the retry is occurring correctly since logged "Retrying request" matches my retry attempt.
The last attempt is the one that looks extraneous. Would you be able to advise why?

Therefore if I use Directly(1) I'm seeting my request sent 3 times instead of 2.

def sendWithRetry[U](promise: => Future[U], retryPolicy: retry.Policy): Future[U] = {
    val retryOnSpecifiedFailurePolicy = retry.When {
      case CustomException() =>
        logger.warn("Retrying request...")
        retryPolicy
    }

    retryOnSpecifiedFailurePolicy(promise)
  }

I'm calling the above like this
sendWithRetry(send(message), retry.Directly(1))
and I have this defined in class scope
implicit val always: retry.Success[Any] = retry.Success.always

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions