You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
it ("retry is making an extra attempt") {
implicit val success = Success[Boolean](identity)
class MyException extends RuntimeException
val thrownEx = new MyException
val called = new AtomicInteger()
def run(): Future[Boolean] = {
info(s"Attempt ${called.incrementAndGet()}")
Future.failed(thrownEx)
}
val policy = retry.When {
// lift an exception into a new policy
case _:MyException => Directly(1)
}
whenReady(policy(run).failed) { _ =>
assert(called.get() === 2)
}
}
If you replace Directly(1) with Pause(1, 1.second) you'll notice that the first 2 attempts are made back-to-back while the third one is made after the 1 second delay.
I was expecting 2 attempts only with the second one delayed by 1 second.
redkhalil
changed the title
Getting extra call and don't know why
Retry is making an extra attempt
May 11, 2019
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.
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
The text was updated successfully, but these errors were encountered: