HedgingPolicy

interface HedgingPolicy

A policy for executing an operation with hedging.

Hedging involves making multiple concurrent requests to the same endpoint or for the same resource. The first successful response is returned, and the remaining requests are canceled. This strategy can reduce latency by mitigating the impact of slow or outlier responses.

It's particularly useful for operations where tail latency is a concern.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun <T> execute(block: suspend () -> T): T

Executes block with multiple parallel attempts; returns the first successful result or throws if all fail.