simple_partition_scaler.go ×6

Frontier kind: Joint frontier

unlabeled · c_c1d608db5727

1 test · 2740 LOC · 137 files · introduces 1 test · 19 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges19 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
418 ranges2740 lines · 137 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

1 file ranked by introduced lines: 19 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/simple_partition_scaler.go 19 introduced LOC · 6 ranges

Open complete file

50 }
51
52 > func (s *simplePartitionScaler) getTracker(interval time.Duration) *taskTracker { simple_partition_scaler.go
53 > if t, ok := s.trackers[interval]; ok {
54 > return t
55 > }
56 > t := newTaskTracker(s.ts, interval/simplePartitionScalerTrackerBuckets, interval)
57 > s.trackers[interval] = t
58 > return t
59 }
60
70 // init trackers in use
71 for _, down := range cfg.Downs {
72 > _ = s.getTracker(down.Window) simple_partition_scaler.go
73 > }
74 for _, up := range cfg.Ups {
75 > _ = s.getTracker(up.Window) simple_partition_scaler.go
76 > }
77
78 // TODO(dp): optimization: use one tracker and query it for different intervals.
79 // TODO(dp): clean up trackers that are unused after config change.
80 for _, t := range s.trackers {
81 > t.inc(in.NumTasks) simple_partition_scaler.go
82 > }
83
84 // unmarshal our state
92 addTarget, fullInterval := s.updateAddTarget(cfg, int(state.AddTarget))
93 if !fullInterval {
94 > return PartitionScalerDecision{NoChange: true} simple_partition_scaler.go
95 > }
96 state.AddTarget = int32(addTarget)
97
126 // a log of those in the scale state
127 for _, down := range cfg.Downs {
128 > rate, full := s.getTracker(down.Window).rateAndFull() simple_partition_scaler.go
129 > if !full {
130 > return 0, false
131 > }
132 // decrease target so that each partition is ~= target rate
133 target = max(1, min(