Skip to content

Commit 3dd5cf5

Browse files
authored
Merge pull request #201 from durable-workflow/docs/361-retry-precision
docs: describe fractional durable retry intervals
2 parents 6bf63a1 + 2cf90bf commit 3dd5cf5

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎docs/reference/workflow.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ Workflow retry and timeout settings are durable command budgets. Use
4545
`ChildWorkflowRetryPolicy` on `ctx.start_child_workflow(...)` for child workflow
4646
attempts. Use `TransportRetryPolicy` only for client HTTP retries.
4747

48+
## Durable delay resolution
49+
50+
`ActivityRetryPolicy` uses whole-second durable retry intervals:
51+
52+
| Parameter | Accepted value and conversion |
53+
| --- | --- |
54+
| `initial_interval_seconds` | Non-negative float. Each generated interval is rounded up to a whole second. `0.1` becomes `1`. |
55+
| `maximum_interval_seconds` | Optional non-negative float. Caps the generated interval before rounding, so a cap of `0.1` still encodes one second. |
56+
| `backoff_seconds` | Explicit list of integer seconds. Use integers rather than fractional values. |
57+
58+
`ctx.start_timer(seconds)` takes integer seconds. `ctx.sleep(seconds)` accepts
59+
a float and rounds positive fractions up to the next whole second. Zero stays
60+
zero. These are durable scheduling delays, so queue latency or worker load can
61+
make actual execution later. HTTP transport retry delays are a separate policy
62+
and do not use this durable-command conversion.
63+
4864
Use `ctx.call_nexus_service(...)` from workflow code to start a Nexus service
4965
operation durably. Admission uses the leased workflow command. Synchronous
5066
completion waits remain suspended until a durable terminal service event,

‎src/durable_workflow/workflow.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ class ActivityRetryPolicy:
316316
budget for an already-scheduled activity. It is a server-side durable
317317
retry policy, not the SDK HTTP transport retry policy.
318318
319+
``initial_interval_seconds`` and ``maximum_interval_seconds`` accept
320+
fractional seconds. Each generated interval is capped first, then rounded
321+
up to a whole second for the durable command. For example, an initial
322+
interval of ``0.1`` becomes one second. The explicit ``backoff_seconds``
323+
list instead takes integer seconds. This resolution does not guarantee
324+
when a worker will start the next attempt.
325+
319326
``non_retryable_error_types`` names failure types that should bypass this
320327
retry budget. An activity worker can also report ``non_retryable=True`` on
321328
a failure to stop retrying that activity execution.

0 commit comments

Comments
 (0)