spec.go ×6

Frontier kind: Code frontier

unlabeled · c_87bbaa11edf6

200 tests · 2480 LOC · 117 files · introduces 0 tests · 23 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges23 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
389 ranges2480 lines · 117 files · Browse complete extent
All tests (intent)
200 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: 23 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/scheduler/spec.go 23 introduced LOC · 6 ranges

Open complete file

293 // Returns: Nominal is the time that matches, pre-jitter. Next is the nominal time with
294 // jitter applied. If there is no matching time, Nominal and Next will be the zero time.
295 > func (cs *CompiledSpec) GetNextTime(jitterSeed string, after time.Time) (GetNextTimeResult, error) { spec.go
296 > // If we're starting before the schedule's allowed time range, jump up to right before
297 > // it (so that we can still return the first second of the range if it happens to match).
298 > // note: AsTime returns unix epoch on nil StartTime
299 > after = util.MaxTime(after, cs.spec.StartTime.AsTime().Add(-time.Second))
300 >
301 > pastEndTime := func(t time.Time) bool {
302 return cs.spec.EndTime != nil && t.After(cs.spec.EndTime.AsTime()) || t.Year() > maxCalendarYear
303 }
304 > warnIterations := cs.warnIterations() spec.go
305 > if warnIterations <= 0 {
306 warnIterations = DefaultWarnIterations
307 }
308 > maxIterations := cs.maxIterations() spec.go
309 > if maxIterations <= 0 {
310 maxIterations = math.MaxInt // disabled: effectively unlimited
311 }
312
313 > var warned bool spec.go
314 > var nominal time.Time
315 > for iterations := 0; nominal.IsZero() || cs.excluded(nominal); iterations++ {
316 > // Hard bound: stop an over-excluded / adversarial spec from spinning toward
317 > // maxCalendarYear. Disabled by default (maxIterations == math.MaxInt); an operator can
318 > // lower it to re-enable enforcement. Well-formed specs resolve in a handful of iterations.
319 > if iterations >= maxIterations {
320 return GetNextTimeResult{ComputeLimitWarning: true}, ErrComputeLimitExceeded
321 }
322 > if iterations >= warnIterations { spec.go
323 warned = true
324 }
325 > nominal = cs.rawNextTime(after) spec.go
326 > after = nominal
327 >
328 > if nominal.IsZero() || pastEndTime(nominal) {
329 return GetNextTimeResult{ComputeLimitWarning: warned}, nil
330 }