Skip to content

Add poller group ID tracking across all poller types#2254

Open
tconley1428 wants to merge 9 commits intomainfrom
poller-group-id-sdk-go
Open

Add poller group ID tracking across all poller types#2254
tconley1428 wants to merge 9 commits intomainfrom
poller-group-id-sdk-go

Conversation

@tconley1428
Copy link
Copy Markdown

Summary

  • Add pollerGroupTracker that distributes poll requests across server-provided poller groups using weighted random selection, prioritizing groups with zero pending polls
  • Integrate tracker into workflow, activity, and nexus task pollers: set PollerGroupId on poll requests and update groups from poll responses
  • Forward PollerGroupId from poll responses to RespondQueryTaskCompleted, RespondNexusTaskCompleted, and RespondNexusTaskFailed for proper routing

Depends on API changes from temporalio/api#744

Test plan

  • Unit tests for pollerGroupTracker (zero-pending prioritization, weighted distribution, release, group updates)
  • Unit tests for weightedRandom (single candidate, zero weights, convergence)
  • Integration tests verifying PollerGroupId is empty on first poll, set on subsequent polls for all three poller types
  • Integration tests verifying PollerGroupId forwarding on query responses (success and error paths)
  • Integration tests verifying PollerGroupId forwarding on nexus completion and failure (via full Execute path)
  • Integration test for GRPC-too-large query response fallback path

🤖 Generated with Claude Code

tconley1428 and others added 6 commits March 25, 2026 15:56
Integrate poller group assignment across all three poller types. On each
poll, the SDK selects a group ID via weighted random distribution from
server-provided poller groups and sets it on the request. Groups from
poll responses update the tracker. The response poller_group_id is
forwarded on RespondQueryTaskCompleted, RespondNexusTaskCompleted, and
RespondNexusTaskFailed for proper routing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover poll request/response flow for all three poller types,
PollerGroupId forwarding on query and nexus respond RPCs, and the
GRPC-too-large fallback path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	internal/internal_nexus_task_poller.go
# Conflicts:
#	go.sum
#	internal/internal_task_pollers.go
#	internal/internal_workflow_testsuite.go
@tconley1428 tconley1428 marked this pull request as ready for review April 28, 2026 22:58
@tconley1428 tconley1428 requested a review from a team as a code owner April 28, 2026 22:58
Copy link
Copy Markdown
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally makes sense, only one structural change I think could simplify things slightly

Comment thread internal/internal_task_pollers.go Outdated
Comment thread internal/poller_group_tracker.go Outdated
Comment thread internal/poller_group_tracker.go Outdated
# Conflicts:
#	contrib/datadog/go.mod
#	contrib/opentelemetry/go.mod
#	contrib/opentelemetry/go.sum
#	test/go.mod
#	test/go.sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants