ratelimit_manager.go ×6

Frontier kind: Code frontier

unlabeled · c_b430bb16a669

164 tests · 3135 LOC · 143 files · introduces 0 tests · 24 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges24 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
476 ranges3135 lines · 143 files · Browse complete extent
All tests (intent)
164 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: 24 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/ratelimit_manager.go 22 introduced LOC · 6 ranges

Open complete file

213 // Updates the API-configured RPS based on the latest user data
214 // and applies the new rate limit if the effective RPS has changed.
215 > func (r *rateLimitManager) UserDataChanged() { ratelimit_manager.go
216 > r.mu.Lock()
217 > defer r.mu.Unlock()
218 > // Fetch the latest user data and update the API-configured RPS.
219 > r.trySetRPSFromUserDataLocked()
220 > r.computeAndApplyRateLimitLocked()
221 > }
222
223 // trySetRPSFromUserDataLocked sets the apiConfigRPS from user data.
224 // Called exclusively in response to updates in user data.
225 > func (r *rateLimitManager) trySetRPSFromUserDataLocked() { ratelimit_manager.go
226 > userData, _, err := r.userDataManager.GetUserData()
227 > if err != nil {
228 return
229 }
230 > config := userData.GetData().GetPerType()[int32(r.taskQueueType)].GetConfig() ratelimit_manager.go
231 > // If rate limit is an empty message, it means rate limit could have been unset via API.
232 > // In this case, the apiConfigRPS will need to be unset.
233 > queueRateLimit := config.GetQueueRateLimit()
234 > if queueRateLimit.GetRateLimit() == nil {
235 > r.apiConfigRPS = nil
236 > } else {
237 val := float64(queueRateLimit.GetRateLimit().GetRequestsPerSecond())
238 r.apiConfigRPS = &val
239 }
240 > fairnessKeyRateLimitDefault := config.GetFairnessKeysRateLimitDefault() ratelimit_manager.go
241 > if fairnessKeyRateLimitDefault.GetRateLimit() == nil {
242 r.fairnessKeyRateLimitDefault = nil
243 > } else { ratelimit_manager.go
244 // Maintain the fairnessKeyRateLimitDefault as per-partition rate, scaled by the same
245 // fraction applied to the whole-queue effectiveRPS.
248 r.fairnessKeyRateLimitDefault = &val
249 }
250 > fairnessWeightOverrides := config.GetFairnessWeightOverrides() ratelimit_manager.go
251 > r.perKeyOverrides = fairnessWeightOverrides
252 }
253
go.temporal.io/server/api/persistence/v1/task_queues.pb.go 2 introduced LOC · 1 range

Open complete file

629 }
630
631 > func (x *TaskQueueTypeUserData) GetConfig() *v11.TaskQueueConfig { task_queues.pb.go
632 > if x != nil {
633 return x.Config
634 }