Feat: Add jitterfactor to retry policy#1687
Feat: Add jitterfactor to retry policy#1687javier-aliaga wants to merge 6 commits intodapr:masterfrom
Conversation
Signed-off-by: Javier Aliaga <javier@diagrid.io>
Signed-off-by: Javier Aliaga <javier@diagrid.io>
Signed-off-by: Javier Aliaga <javier@diagrid.io>
There was a problem hiding this comment.
Pull request overview
Adds support for a configurable retry “jitter factor” and wires it through workflow-to-durable retry policy conversion, enabling deterministic jittered backoff in the durable task executor to reduce retry synchronization (“thundering herd”).
Changes:
- Add
jitterFactortoWorkflowTaskRetryPolicyand propagate it todurabletaskRetryPolicy. - Apply deterministic jitter to computed retry delays in
TaskOrchestrationExecutor. - Add unit tests for jitter factor validation/defaults and for
maxRetryIntervalpropagation in workflow context.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java | Adds jitterFactor field + builder setter; updates constructor signature to include jitter. |
| sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java | Propagates maxRetryInterval (when set) and jitterFactor into durable RetryPolicy. |
| sdk-workflows/src/test/java/io/dapr/workflows/DefaultWorkflowContextTest.java | Adds tests verifying maxRetryInterval propagation and default behavior. |
| sdk-workflows/src/test/java/io/dapr/workflows/WorkflowTaskRetryPolicyTest.java | Adds tests for jitter defaults, boundaries, null-constructor behavior, and chaining. |
| durabletask-client/src/main/java/io/dapr/durabletask/RetryPolicy.java | Adds jitterFactor field with setter/getter and validation. |
| durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java | Applies deterministic jitter reduction to retry delays during orchestration execution. |
| durabletask-client/src/test/java/io/dapr/durabletask/RetryPolicyTest.java | Adds tests for jitter defaults/range checks and documents deterministic jitter math. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
durabletask-client/src/test/java/io/dapr/durabletask/RetryPolicyTest.java
Outdated
Show resolved
Hide resolved
sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java
Show resolved
Hide resolved
sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java
Outdated
Show resolved
Hide resolved
durabletask-client/src/main/java/io/dapr/durabletask/RetryPolicy.java
Outdated
Show resolved
Hide resolved
durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java
Outdated
Show resolved
Hide resolved
sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java
Show resolved
Hide resolved
sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java
Outdated
Show resolved
Hide resolved
durabletask-client/src/main/java/io/dapr/durabletask/RetryPolicy.java
Outdated
Show resolved
Hide resolved
durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java
Outdated
Show resolved
Hide resolved
durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java
Outdated
Show resolved
Hide resolved
sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Javier Aliaga <javier@diagrid.io>
2ff90e4 to
987919e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java
Show resolved
Hide resolved
durabletask-client/src/test/java/io/dapr/durabletask/RetryPolicyTest.java
Outdated
Show resolved
Hide resolved
durabletask-client/src/test/java/io/dapr/durabletask/RetryPolicyTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Javier Aliaga <javier@diagrid.io>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1687 +/- ##
============================================
+ Coverage 79.51% 79.56% +0.04%
- Complexity 2194 2195 +1
============================================
Files 237 237
Lines 6577 6587 +10
Branches 730 731 +1
============================================
+ Hits 5230 5241 +11
+ Misses 992 989 -3
- Partials 355 357 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Please explain the changes you've made
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: