matcher_data.go ×2

Frontier kind: Code frontier

unlabeled · c_5ecf29a7232a

190 tests · 2644 LOC · 135 files · introduces 0 tests · 19 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
2 ranges19 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
393 ranges2644 lines · 135 files · Browse complete extent
All tests (intent)
190 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.

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

go.temporal.io/server/service/matching/matcher_data.go 19 introduced LOC · 2 ranges

Open complete file

706
707 // consume updates ready based on the current time and number of new tokens consumed.
708 > func (ready simpleLimiter) consume(p simpleLimiterParams, now int64, tokens int64) simpleLimiter { matcher_data.go
709 > // This is a slight variation of the normal GCRA: instead of tracking the end of the
710 > // allowed interval (the theoretical arrival time), ready tracks the beginning of it, and
711 > // the end is ready + burst. To find the next ready time:
712 > // - Add ready+burst to find the next theoretical arrival time.
713 > // - If that's in the past, clip it at the current time.
714 > // - Subtract burst to turn it back into a ready time.
715 > // - Finally add the tokens we used.
716 > //
717 > // For intuition, consider that if if now is > ready by only a tiny amount, i.e. we're
718 > // bursting, then the max takes ready+burst and we push up the ready time by the full
719 > // interval. We can do this burst/interval times before it catches up and we're no longer
720 > // ready.
721 > //
722 > // Alternatively, if now is > ready by more than burst, then we end up subtracting the full
723 > // burst from now and adding one interval.
724 > if p.never() {
725 return simpleLimiterNever
726 }
727 > clippedReady := max(now, int64(ready)+p.burst.Nanoseconds()) - p.burst.Nanoseconds() matcher_data.go
728 > return simpleLimiter(clippedReady + tokens*p.interval.Nanoseconds())
729 }
730