task_queue_partition_manager.go ×8

Frontier kind: Code frontier

unlabeled · c_ceec743e1c23

219 tests · 4155 LOC · 173 files · introduces 0 tests · 25 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges25 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
742 ranges4155 lines · 173 files · Browse complete extent
All tests (intent)
219 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 25 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/task_queue_partition_manager.go 18 introduced LOC · 8 ranges

Open complete file

731 ctx context.Context,
732 pollMetadata *pollMetadata,
733 > ) (*internalTask, bool, error) { task_queue_partition_manager.go
734 > defer pm.sendPartitionCountTrailer(ctx)
735 > if err := pm.checkPartitionCounts(ctx, false); err != nil {
736 return nil, false, err
737 }
738
739 > var err error task_queue_partition_manager.go
740 > dbq := pm.defaultQueue()
741 > if dbq == nil {
742 return nil, false, errDefaultQueueNotInit
743 }
744 > versionSetUsed := false task_queue_partition_manager.go
745 > deployment, err := worker_versioning.DeploymentFromCapabilities(pollMetadata.workerVersionCapabilities, pollMetadata.deploymentOptions)
746 > if err != nil {
747 return nil, false, err
748 }
749
750 > if deployment != nil { task_queue_partition_manager.go
751 if pm.partition.Kind() == enumspb.TASK_QUEUE_KIND_STICKY {
752 // TODO: reject poller of old sticky queue if newer version exist
825 }
826
827 > identity, hasIdentity := ctx.Value(identityKey).(string) task_queue_partition_manager.go
828 > if hasIdentity && identity != "" {
829 dbq.UpdatePollerInfo(pollerIdentity(identity), pollMetadata)
830 }
839 // UpdateRateLimit implicitly handles whether an update is required or not,
840 // based on whether the effectiveRPS has changed.
841 > pm.rateLimitManager.InjectWorkerRPS(pollMetadata) task_queue_partition_manager.go
842 >
843 > task, err := dbq.PollTask(ctx, pollMetadata)
844 > if task != nil {
845 task.pollerScalingDecision = dbq.MakePollerScalingDecision(ctx, pollMetadata.localPollStartTime)
846 }
848 // Update poller timestamp when poll ends, unless cancelled (e.g., shutdown/disconnect).
849 // Skip on cancellation to avoid re-adding entry after RemovePoller was called.
850 > if hasIdentity && identity != "" && ctx.Err() != context.Canceled { task_queue_partition_manager.go
851 dbq.UpdatePollerInfo(pollerIdentity(identity), pollMetadata)
852 }
853
854 > return task, versionSetUsed, err task_queue_partition_manager.go
855 }
856
go.temporal.io/server/service/matching/ratelimit_manager.go 7 introduced LOC · 2 ranges

Open complete file

184 // Called whenever a new poll request comes in.
185 // This allows the rate limit manager to adjust its rate limits based on any updates right before polling happens.
186 > func (r *rateLimitManager) InjectWorkerRPS(meta *pollMetadata) { ratelimit_manager.go
187 > r.mu.Lock()
188 > defer r.mu.Unlock()
189 > var rps *float64
190 > if meta != nil && meta.taskQueueMetadata != nil {
191 if workerRPS := meta.taskQueueMetadata.GetMaxTasksPerSecond(); workerRPS != nil {
192 value := workerRPS.GetValue()
194 }
195 }
196 > r.workerRPS = rps ratelimit_manager.go
197 > r.computeAndApplyRateLimitLocked()
198 }
199