@@ -43,6 +43,7 @@ async def publish(
4343 callback_headers : Optional [Dict [str , str ]] = None ,
4444 failure_callback_headers : Optional [Dict [str , str ]] = None ,
4545 retries : Optional [int ] = None ,
46+ retry_delay : Optional [str ] = None ,
4647 callback : Optional [str ] = None ,
4748 failure_callback : Optional [str ] = None ,
4849 delay : Optional [Union [str , int ]] = None ,
@@ -74,6 +75,34 @@ async def publish(
7475 callback message.
7576 :param retries: How often should this message be retried in case the destination
7677 API is not available.
78+ :param retry_delay: Delay between retries.
79+
80+ By default, the `retryDelay` is exponential backoff.
81+ More details can be found in: https://upstash.com/docs/qstash/features/retry.
82+
83+ The `retryDelay` option allows you to customize the delay (in milliseconds) between retry attempts when message delivery fails.
84+
85+ You can use mathematical expressions and the following built-in functions to calculate the delay dynamically.
86+ The special variable `retried` represents the current retry attempt count (starting from 0).
87+
88+ Supported functions:
89+ - `pow`
90+ - `sqrt`
91+ - `abs`
92+ - `exp`
93+ - `floor`
94+ - `ceil`
95+ - `round`
96+ - `min`
97+ - `max`
98+
99+ Examples of valid `retryDelay` values:
100+ ```py
101+ 1000 # 1 second
102+ 1000 * (1 + retried) # 1 second multiplied by the current retry attempt
103+ pow(2, retried) # 2 to the power of the current retry attempt
104+ max(10, pow(2, retried)) # The greater of 10 or 2^retried
105+ ```
77106 :param callback: A callback url that will be called after each attempt.
78107 :param failure_callback: A failure callback url that will be called when a delivery
79108 is failed, that is when all the defined retries are exhausted.
@@ -109,6 +138,7 @@ async def publish(
109138 callback_headers = callback_headers ,
110139 failure_callback_headers = failure_callback_headers ,
111140 retries = retries ,
141+ retry_delay = retry_delay ,
112142 callback = callback ,
113143 failure_callback = failure_callback ,
114144 delay = delay ,
@@ -140,6 +170,7 @@ async def publish_json(
140170 callback_headers : Optional [Dict [str , str ]] = None ,
141171 failure_callback_headers : Optional [Dict [str , str ]] = None ,
142172 retries : Optional [int ] = None ,
173+ retry_delay : Optional [str ] = None ,
143174 callback : Optional [str ] = None ,
144175 failure_callback : Optional [str ] = None ,
145176 delay : Optional [Union [str , int ]] = None ,
@@ -172,6 +203,34 @@ async def publish_json(
172203 callback message.
173204 :param retries: How often should this message be retried in case the destination
174205 API is not available.
206+ :param retry_delay: Delay between retries.
207+
208+ By default, the `retryDelay` is exponential backoff.
209+ More details can be found in: https://upstash.com/docs/qstash/features/retry.
210+
211+ The `retryDelay` option allows you to customize the delay (in milliseconds) between retry attempts when message delivery fails.
212+
213+ You can use mathematical expressions and the following built-in functions to calculate the delay dynamically.
214+ The special variable `retried` represents the current retry attempt count (starting from 0).
215+
216+ Supported functions:
217+ - `pow`
218+ - `sqrt`
219+ - `abs`
220+ - `exp`
221+ - `floor`
222+ - `ceil`
223+ - `round`
224+ - `min`
225+ - `max`
226+
227+ Examples of valid `retryDelay` values:
228+ ```py
229+ 1000 # 1 second
230+ 1000 * (1 + retried) # 1 second multiplied by the current retry attempt
231+ pow(2, retried) # 2 to the power of the current retry attempt
232+ max(10, pow(2, retried)) # The greater of 10 or 2^retried
233+ ```
175234 :param callback: A callback url that will be called after each attempt.
176235 :param failure_callback: A failure callback url that will be called when a delivery
177236 is failed, that is when all the defined retries are exhausted.
@@ -203,6 +262,7 @@ async def publish_json(
203262 callback_headers = callback_headers ,
204263 failure_callback_headers = failure_callback_headers ,
205264 retries = retries ,
265+ retry_delay = retry_delay ,
206266 callback = callback ,
207267 failure_callback = failure_callback ,
208268 delay = delay ,
@@ -227,6 +287,7 @@ async def enqueue(
227287 callback_headers : Optional [Dict [str , str ]] = None ,
228288 failure_callback_headers : Optional [Dict [str , str ]] = None ,
229289 retries : Optional [int ] = None ,
290+ retry_delay : Optional [str ] = None ,
230291 callback : Optional [str ] = None ,
231292 failure_callback : Optional [str ] = None ,
232293 deduplication_id : Optional [str ] = None ,
@@ -257,6 +318,34 @@ async def enqueue(
257318 callback message.
258319 :param retries: How often should this message be retried in case the destination
259320 API is not available.
321+ :param retry_delay: Delay between retries.
322+
323+ By default, the `retryDelay` is exponential backoff.
324+ More details can be found in: https://upstash.com/docs/qstash/features/retry.
325+
326+ The `retryDelay` option allows you to customize the delay (in milliseconds) between retry attempts when message delivery fails.
327+
328+ You can use mathematical expressions and the following built-in functions to calculate the delay dynamically.
329+ The special variable `retried` represents the current retry attempt count (starting from 0).
330+
331+ Supported functions:
332+ - `pow`
333+ - `sqrt`
334+ - `abs`
335+ - `exp`
336+ - `floor`
337+ - `ceil`
338+ - `round`
339+ - `min`
340+ - `max`
341+
342+ Examples of valid `retryDelay` values:
343+ ```py
344+ 1000 # 1 second
345+ 1000 * (1 + retried) # 1 second multiplied by the current retry attempt
346+ pow(2, retried) # 2 to the power of the current retry attempt
347+ max(10, pow(2, retried)) # The greater of 10 or 2^retried
348+ ```
260349 :param callback: A callback url that will be called after each attempt.
261350 :param failure_callback: A failure callback url that will be called when a delivery
262351 is failed, that is when all the defined retries are exhausted.
@@ -283,6 +372,7 @@ async def enqueue(
283372 callback_headers = callback_headers ,
284373 failure_callback_headers = failure_callback_headers ,
285374 retries = retries ,
375+ retry_delay = retry_delay ,
286376 callback = callback ,
287377 failure_callback = failure_callback ,
288378 delay = None ,
@@ -315,6 +405,7 @@ async def enqueue_json(
315405 callback_headers : Optional [Dict [str , str ]] = None ,
316406 failure_callback_headers : Optional [Dict [str , str ]] = None ,
317407 retries : Optional [int ] = None ,
408+ retry_delay : Optional [str ] = None ,
318409 callback : Optional [str ] = None ,
319410 failure_callback : Optional [str ] = None ,
320411 deduplication_id : Optional [str ] = None ,
@@ -346,6 +437,34 @@ async def enqueue_json(
346437 callback message.
347438 :param retries: How often should this message be retried in case the destination
348439 API is not available.
440+ :param retry_delay: Delay between retries.
441+
442+ By default, the `retryDelay` is exponential backoff.
443+ More details can be found in: https://upstash.com/docs/qstash/features/retry.
444+
445+ The `retryDelay` option allows you to customize the delay (in milliseconds) between retry attempts when message delivery fails.
446+
447+ You can use mathematical expressions and the following built-in functions to calculate the delay dynamically.
448+ The special variable `retried` represents the current retry attempt count (starting from 0).
449+
450+ Supported functions:
451+ - `pow`
452+ - `sqrt`
453+ - `abs`
454+ - `exp`
455+ - `floor`
456+ - `ceil`
457+ - `round`
458+ - `min`
459+ - `max`
460+
461+ Examples of valid `retryDelay` values:
462+ ```py
463+ 1000 # 1 second
464+ 1000 * (1 + retried) # 1 second multiplied by the current retry attempt
465+ pow(2, retried) # 2 to the power of the current retry attempt
466+ max(10, pow(2, retried)) # The greater of 10 or 2^retried
467+ ```
349468 :param callback: A callback url that will be called after each attempt.
350469 :param failure_callback: A failure callback url that will be called when a delivery
351470 is failed, that is when all the defined retries are exhausted.
@@ -369,6 +488,7 @@ async def enqueue_json(
369488 callback_headers = callback_headers ,
370489 failure_callback_headers = failure_callback_headers ,
371490 retries = retries ,
491+ retry_delay = retry_delay ,
372492 callback = callback ,
373493 failure_callback = failure_callback ,
374494 deduplication_id = deduplication_id ,
0 commit comments