Add configurable max_task_poll_retries to WorkerConfig#1
Open
soutar wants to merge 1 commit intoworkflow-sdkfrom
Open
Add configurable max_task_poll_retries to WorkerConfig#1soutar wants to merge 1 commit intoworkflow-sdkfrom
soutar wants to merge 1 commit intoworkflow-sdkfrom
Conversation
During INC-33, workers retried poll_workflow_task_queue indefinitely for 50 minutes on stuck connections (TimeoutExpired errors). The SDK's task_poll_retry_policy() hardcodes max_retries: 0 (unlimited). Add max_task_poll_retries field to WorkerConfig (default 0 = unlimited, preserving existing behavior). When set to a nonzero value, the worker's RetryClient uses a modified poll retry policy with a finite retry limit. After exhausting retries, the error propagates through the poller stream, causing the worker to exit so the orchestrator can restart it with fresh connections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max_task_poll_retriesfield toWorkerConfig(default 0 = unlimited, preserving existing behavior)task_poll_retry_overridetoRetryClientwithwith_task_poll_retry_config()builder methodWorkerConfig.max_task_poll_retries→RetryClientininit_worker_client()Context
During INC-33, our Temporal workers retried
poll_workflow_task_queueindefinitely for 50 minutes on stuck connections (TimeoutExpirederrors). The SDK'stask_poll_retry_policy()hardcodesmax_retries: 0(unlimited). With this change, setting a nonzeromax_task_poll_retriescauses the worker to exit after that many consecutive poll failures, allowing Kubernetes to restart the pod with fresh connections.Error propagation path
RetryClient → ForwardError → wft_poller yields Err → workflow_stream "fatal error" → worker.run() returns Err → main() exits → K8s restarts pod
Test plan
cargo buildpassescargo test -p temporal-client -- retry— all 10 existing tests passcargo checkwith downstream consumer (tella-fusion temporal worker)🤖 Generated with Claude Code