Deduplicate poll cancellation RPCs by destination host#10230
Merged
Conversation
When ShutdownWorker fans out CancelOutstandingWorkerPolls to all partitions, multiple partitions may route to the same matching host. Since the RPC cancels all pollers for the workerInstanceKey on the target host regardless of partition, redundant RPCs are wasted. Use Route() to deduplicate by host, reducing RPCs from numPartitions to numHosts per task type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e3cf9cd to
3260c43
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3260c43 to
9865b93
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ShahabT
approved these changes
May 12, 2026
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.
What
Deduplicates
CancelOutstandingWorkerPollsRPCs by destination matching host duringShutdownWorker. UsesRoute()on the matching client to determine which host each partition maps to, then sends only one RPC per unique host instead of one per partition.Why
With N partitions across H matching hosts (H << N), the current code sends N RPCs per task type when H would suffice — the RPC cancels all pollers for the
workerInstanceKeyon the target host regardless of which partition was used for routing.How did you test it?
Unit test
🤖 Generated with Claude Code