Retry

org.http4s.client.middleware.Retry$
object Retry

Attributes

Source:
Retry.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Retry.type

Members list

Concise view

Value members

Concrete methods

def apply[F[_]](policy: () => F, redactHeaderWhen: CIString => Boolean)(client: Client[F])(implicit F: Temporal[F]): Client[F]

Attributes

Source:
Retry.scala
def h.retrymatch{ caseLeft(date)=> toFunctorOps[F,FiniteDuration](F.realTime)(F).map[FiniteDuration](((_$3:FiniteDuration)=>date.toDuration.-(_$3))) caseRight(secs)=> catsSyntaxApplicativeId[FiniteDuration](DurationLong(secs).seconds).pure[F](F) })).getOrElse[F[FiniteDuration]](catsSyntaxApplicativeId[FiniteDuration](DurationInt(0).seconds).pure[F](F)) valsleepDuration:F[FiniteDuration]=toFunctorOps[F,FiniteDuration](headerDuration)(F).map[FiniteDuration](((_$4:FiniteDuration)=>_$4.max(duration))) catsSyntaxFlatMapOps[F,Unit](toFlatMapOps[F,FiniteDuration](sleepDuration)(F).flatMap[Unit](((_$5:FiniteDuration)=>F.sleep(_$5))))(F).>>[Response[F]](retryLoop(req,attempts.+(1),hotswap))(F) } defretryLoop(`req₂`:Request[F],`attempts₂`:Int,`hotswap₂`:Hotswap[F,Either[Throwable,Response[F]]]):F[Response[F]]=catsSyntaxApply[F,Unit](`hotswap₂`.clear)(F).*>[Response[F]](toFlatMapOps[F,Either[Throwable,Response[F]]](`hotswap₂`.swap(client.run(`req₂`.withAttribute[Int](AttemptCountKey,`attempts₂`)).map[Response[F]](((_$6:Response[F])=>_$6.withAttribute[Int](AttemptCountKey,`attempts₂`))).attempt[Throwable](F)))(F).flatMap[Response[F]](((x$1:Either[Throwable,Response[F]])=>x$1match{ caseRight(response)=> policy.apply(`req₂`,Right.apply[Nothing,Response[F]](response),`attempts₂`)match{ caseSome(duration)=> if(logRetries)logger.info(_root_.scala.StringContext.apply("Request","hasfailedonattempt#","withreason",".Retryingafter",".").s(showRequest(`req₂`,redactHeaderWhen),`attempts₂`,response.status,`duration₂`)).unsafeRunSync()else() nextAttempt(`req₂`,`attempts₂`,`duration₂`,response.headers.get[Retry-After](singleHeaders[Retry-After](headerInstance)),`hotswap₂`) caseNone=> F.pure[Response[F]](response) } caseLeft(e)=> policy.apply(`req₂`,Left.apply[Throwable,Nothing](e),`attempts₂`)match{ caseSome(duration)=> if(logRetries)logger.info(e)(_root_.scala.StringContext.apply("Requestthrewanexceptiononattempt#",".Retryingafter","").s(`attempts₂`,`duration₃`)).unsafeRunSync()else() nextAttempt(`req₂`,`attempts₂`,`duration₃`,None,`hotswap₂`) caseNone=> if(logRetries)logger.info(e)(_root_.scala.StringContext.apply("Request","threwanexceptiononattempt#",".Givingup.").s(showRequest(`req₂`,redactHeaderWhen),`attempts₂`)).unsafeRunSync()else() F.raiseError[Response[F]](e) } }))) Client.apply[F](((`req₃`:Request[F])=>Hotswap.create[F,Either[Throwable,Response[F]]](F).flatMap[Response[F]](((`hotswap₃`:Hotswap[F,Either[Throwable,Response[F]]])=>Resource.eval[F,Response[F]](retryLoop(`req₃`,1,`hotswap₃`))))))(F) }" t="n"class="documentableName ">create[F[_]](policy: () => F, redactHeaderWhen: CIString => Boolean, logRetries: Boolean)(client: Client[F])(implicit F: Temporal[F]): Client[F]

Attributes

Source:
Retry.scala

Concrete fields

This key tracks the attempt count, the retry middleware starts the very first request with 1 as the first request, even with no retries (aka the first attempt). If one wants to monitor retries explicitly and not the attempts one may want to subtract the value of this key by 1.

This key tracks the attempt count, the retry middleware starts the very first request with 1 as the first request, even with no retries (aka the first attempt). If one wants to monitor retries explicitly and not the attempts one may want to subtract the value of this key by 1.

Attributes

Source:
Retry.scala