ratelimit_manager.go ×4

Frontier kind: Code frontier

unlabeled · c_e04aca0119b5

3 tests · 3713 LOC · 156 files · introduces 0 tests · 30 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges30 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
623 ranges3713 lines · 156 files · Browse complete extent
All tests (intent)
3 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: 30 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/ratelimit_manager.go 24 introduced LOC · 4 ranges

Open complete file

334 }
335
336 > func (r *rateLimitManager) readyTimeForTask(task *internalTask) simpleLimiter { ratelimit_manager.go
337 > r.mu.Lock()
338 > defer r.mu.Unlock()
339 > // TODO(pri): after we have task-specific ready time, we can re-enable this
340 > // if task.isForwarded() {
341 > // // don't count any rate limit for forwarded tasks, it was counted on the child
342 > // return 0
343 > // }
344 > ready := r.wholeQueueReady
345 >
346 > if r.perKeyLimit.limited() {
347 > key := task.getPriority().GetFairnessKey()
348 > if v := r.perKeyReady.Get(key); v != nil {
349 > ready = max(ready, v.(simpleLimiter))
350 > }
351 }
352
353 > return ready ratelimit_manager.go
354 }
355
365
366 if r.perKeyLimit.limited() {
367 > pri := task.getPriority() ratelimit_manager.go
368 > key := pri.GetFairnessKey()
369 > weight := getEffectiveWeight(r.perKeyOverrides, pri)
370 > p := r.perKeyLimit
371 > p.interval = time.Duration(float32(p.interval) / weight) // scale by weight
372 > var sl simpleLimiter
373 > if v := r.perKeyReady.Get(key); v != nil {
374 sl = v.(simpleLimiter) // nolint:revive
375 }
376 > r.perKeyReady.Put(key, sl.consume(p, now, tokens)) ratelimit_manager.go
377 }
378 }
go.temporal.io/server/service/matching/matcher_data.go 6 introduced LOC · 1 range

Open complete file

471 // knows when the soonest one becomes ready
472 if perKeyLimited {
473 > delay := d.rateLimitManager.readyTimeForTask(task).delay(now) matcher_data.go
474 > if delay > 0 {
475 > if minDelay == 0 || delay < minDelay {
476 > minDelay = delay
477 > }
478 > return true
479 }
480 }