Skip to content

Add lf.with_hedging(func, hedge_after, max_hedges=1, on_hedge=None), the parallel counterpart of - #771

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_986129830
Sep 23, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_986129830

Conversation

@copybara-service

Copy link
Copy Markdown

Add lf.with_hedging(func, hedge_after, max_hedges=1, on_hedge=None), the parallel counterpart of
lf.with_retry. It re-issues a slow call every hedge_after seconds (up to max_hedges extra
in-flight attempts) and returns the first attempt to succeed, bounding tail latency for idempotent
calls. If every attempt fails, the primary attempt's exception is re-raised. Setting hedge_after to
0 or max_hedges to 0 disables hedging entirely.

@copybara-service
copybara-service Bot force-pushed the test_986129830 branch 8 times, most recently from 4958b38 to c035565 Compare September 23, 2026 00:21
…, the parallel counterpart of

`lf.with_retry`. It re-issues a slow call every `hedge_after` seconds (up to `max_hedges` extra
in-flight attempts) and returns the first attempt to succeed, bounding tail latency for idempotent
calls. If every attempt fails, the primary attempt's exception is re-raised. Setting `hedge_after` to
0 or `max_hedges` to 0 disables hedging entirely.

PiperOrigin-RevId: 986344031
@copybara-service
copybara-service Bot merged commit cae11bc into main Sep 23, 2026
11 checks passed
@copybara-service
copybara-service Bot deleted the test_986129830 branch September 23, 2026 00:29
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

Successfully merging this pull request may close these issues.

1 participant