A retry policy turns a failure into a decision: try again, stop, or hand off to another recovery path. It defines which failures qualify, how many retries are allowed, how attempts are spaced, and how much total time the operation can consume. Retry a condition likely to clear, such as temporary throttling or an interrupted connection. Fail promptly on an invalid request or missing permission unless the workflow has an explicit way to correct it. Treat a timeout as ambiguous: the caller stopped waiting, but the remote operation may still be running or may already have succeeded.
Set both a per-attempt timeout and an overall deadline. For example, a client issuing a read might allow two retries after the initial attempt, wait longer after each failure, and stop if the next attempt cannot fit within the caller's deadline. Exponential backoff gives an overloaded dependency time to recover, and jitter spreads retries from clients that failed at the same time. When a service supplies a retry delay, honor it on retryable responses if the remaining deadline permits. Check whether a configuration field counts retries or total attempts: two retries usually means up to three attempts.
For a job or data pipeline, choose the smallest restart scope that can recover safely. Configure automatic retries on a failed task when completed upstream work can be reused. Restart an entire run only when its stages need to be rebuilt together or the orchestrator cannot safely resume at a narrower boundary. For example, after a worker is lost, an ingestion task can resume from a durable checkpoint if the source and sink support that recovery model. A checkpoint alone does not prevent duplicate writes: if output was committed before progress was recorded, the restarted task may replay the same records. Use transactional commits, stable record keys with upserts, or another deduplication mechanism appropriate to the sink.
Repeating a non-idempotent write is not safe just because the first attempt returned an error. If a request to create a resource times out, reuse the same idempotency key where the service supports it, or reconcile the original outcome before sending another create request. For jobs that time out, verify whether the original execution is actually canceled before starting a replacement that could write to the same destination.
Coordinate retries across layers. If a client library makes three attempts and an orchestrator reruns its task three times in total, one logical operation can produce nine downstream calls. Give short-lived request failures and longer-lived task failures distinct retry budgets, and account for overlapping schedules and concurrency limits. Record attempt counts, failure categories, delays, and final outcomes so operators can distinguish recovery from persistent degradation. When a budget is exhausted, surface the failure, alert the owner, or route an eligible message to a dead-letter queue rather than retrying indefinitely.