Skip to main content

Retry

Many things can go wrong in a serverless environment. If your API does not respond with a success status code (2XX), we retry the request to ensure every message will be delivered.

The maximum number of retries depends on your current plan. By default, we retry the maximum amount of times, but you can set it lower by sending the Upstash-Retries header:

curl -XPOST \
-H 'Authorization: Bearer XXX' \
-H "Content-type: application/json" \
-H "Upstash-Retries: 2" \
-d '{ "hello": "world" }' \
'https://qstash.upstash.io/v1/publish/...'

The backoff algorithm calculates the retry delay based on the number of retries. Each delay is capped at 1 day.

n = how many times this request has been retried
delay = min(86400, e ** (2.5*n)) // in seconds
ndelay
01s
112s
22m28s
330m8ss
46h7m6s