[Feature Request] Retry an Activity on rate-limit / backpressure errors without consuming MaximumAttempts
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 8/100
Direzione di ricerca
This is a design request that names no files or tests, so there is no concrete entry point yet. Read the two proposed options (per-error-type retry policies versus a flag that skips counting an attempt) and the linked #96 and #463 for context. Done would mean a maintainer-agreed design covering attempt counting, ScheduleToClose bounds, and how the attempt number is reported, not a patch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
Activities that call a rate-limited upstream (HTTP 429, quota exceeded, "slow down" responses) need to retry many times while the upstream is saturated. Today every failed attempt, retryable or not, increments the Activity attempt count and counts toward RetryPolicy.MaximumAttempts. There is no way to say "this failure is backpressure, not a real failure: try again later without penalizing the attempt budget."
ApplicationErrorCategory.BENIGN looks like it should help, but it only changes logging and metrics. A benign failure still counts as an attempt.
The existing workarounds each have a significant drawback:
- Retry normally, tuning backoff or
NextRetryDelayfor 429s. A saturated upstream quickly exhaustsMaximumAttempts. That limit was sized for real failures, so you have to choose between failing too early during throttling and allowing far too many retries for genuine errors. - Catch the 429 and sleep or back off inside the Activity. This holds a worker slot for the whole backoff. Work doesn't flow back to the task queue, so there's no real backpressure, and the backoff must fit inside StartToClose and heartbeat timeouts.
- Return a non-retryable or typed failure and retry from the Workflow (timer + new Activity). This works, but it re-implements retry orchestration in every Workflow, adds history events, and gives up the server-managed retry policy.
Describe the solution you'd like
A first-class way for a failure to be retried under a separate budget, or without consuming the main attempt budget, so that throttling and real failures are bounded independently. Possible shapes (not mutually exclusive):
Option A: Per-error-type retry policies on the Activity. Let ActivityOptions map an ApplicationFailure type (or category) to its own RetryPolicy, tracked with its own attempt counter. The Activity-level policy remains the catch-all.
ao := workflow.ActivityOptions{
StartToCloseTimeout: 30 * time.Second,
RetryPolicy: &temporal.RetryPolicy{MaximumAttempts: 5}, // real failures
ErrorTypeRetryPolicies: map[string]*temporal.RetryPolicy{
"RateLimited": {InitialInterval: 2 * time.Second, BackoffCoefficient: 2, MaximumInterval: time.Minute}, // unlimited attempts; bounded by ScheduleToClose
},
}
message ActivityOptions {
// existing...
map<string, temporal.api.common.v1.RetryPolicy> error_type_retry_policies = N;
}
Option B: A failure flag meaning "don't count this attempt." For example, an ApplicationFailure option such as countsTowardMaximumAttempts: false. It could also be implied by a new category such as THROTTLED. The server reschedules the Activity (honoring NextRetryDelay / backoff) without incrementing the attempt counter used for MaximumAttempts. ScheduleToClose still bounds total time, so this cannot retry forever unintentionally.
Either way, the expected behavior is:
- Throttling failures release the worker slot and return the task to the server/queue, providing real backpressure.
NextRetryDelay(e.g. from aRetry-Afterheader) is still honored.- Throttling retries do not exhaust the budget meant for genuine failures, and vice versa. In particular, StartToClose timeouts should not consume the throttling allowance.
- The attempt number seen by the Activity, and visibility/metrics, make it clear which retries were throttling vs. real failures.
Additional context
ApplicationErrorCategory.BENIGNalready lets users classify expected failures for logging and metrics. Extending classification to retry behavior is a natural next step. The original benign-exceptions design listed per-error-type retry policies as future work.- Related: #96 (backoff more on resource-exhausted errors, a client-side analog of the same problem), #463 (customize activity failure logging).
- This request comes up repeatedly from users running high-throughput Activities against third-party APIs, including LLM providers that enforce rate limits and return
Retry-After.
Per-SDK Tickets
- Server -
- Go -
- Java -
- TypeScript -
- Python -
- .NET -
- Ruby -
- Rust -
- PHP -
- Temporal CLI -
- Lingua principale
- Go
- Stelle
- 35
- Fork
- 31
- Merge medio
- 1g 12h
- PR unite (30g)
- 20
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di temporalio/features
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
temporalio/features#967 ·
I maintainer di solito rispondono entro 1 giorno
-
Google Cloud Storage External Storage DriverForse di nuovo libera @jmaeagle99 l’ha presa 37 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 47/100
temporalio/features#924 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
temporalio/features#854 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
temporalio/features#845 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
temporalio/features#827 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di temporalio/features
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
seriousm4x/UpSnap#1786 ·
-
bug feedback ui/ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
peasant-labs/peasant#1307 ·
I maintainer di solito rispondono entro 1 giorno
-
Reformat test names for single-protocol tests to start with Protocol/, i.e. gRPC/ or Websocket/Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
connectrpc/conformance#1211 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort:s impact:med raised-by:desk risk:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
medici-finance/assay#8342 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
hardening
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
inference-sim/inference-sim#2821 ·
I maintainer di solito rispondono entro 1 giorno