Upstash-Retries
header:
n | delay |
---|---|
1 | 12s |
2 | 2m28s |
3 | 30m8ss |
4 | 6h7m6s |
5 | 24h |
6 | 24h |
Upstash-Retry-Delay
header when publishing a message. This allows you to override the default exponential backoff with your own mathematical expressions.
retryDelay
expression can use mathematical functions and the special variable retried
(current retry attempt count starting from 0).
Supported functions:
pow
- Power functionsqrt
- Square rootabs
- Absolute valueexp
- Exponentialfloor
- Floor functionceil
- Ceiling functionround
- Rounding functionmin
- Minimum of valuesmax
- Maximum of values1000
- Fixed 1 second delay1000 * (1 + retried)
- Linear backoff: 1s, 2s, 3s, 4s…pow(2, retried) * 1000
- Exponential backoff: 1s, 2s, 4s, 8s…max(1000, pow(2, retried) * 100)
- Exponential with minimum 1s delayUpstash-Retried
header to requests sent to your API. This
indicates how many times the request has been retried.
Upstash-NonRetryable-Error: true
.
When this header is present, QStash will immediately mark the message as failed and skip any further retry attempts. The message will then be forwarded to the Dead Letter Queue (DLQ) for manual review and resolution.
This mechanism is particularly useful in scenarios where retries are generally enabled but should be bypassed for specific known errors—such as invalid payloads or non-recoverable conditions.