MCPcopy Index your code
hub / github.com/micro/go-micro / LoopMax

Function LoopMax

flow/loop.go:31–31  ·  view source on GitHub ↗

LoopMax sets the hard iteration cap — the budget guardrail. The loop never runs the body more than n times, so it always terminates even when the stop condition never fires. Default 10.

(n int)

Source from the content-addressed store, hash-verified

29// runs the body more than n times, so it always terminates even when the
30// stop condition never fires. Default 10.
31func LoopMax(n int) LoopOption { return func(o *LoopOptions) { o.Max = n } }
32
33// Until stops the loop when cond returns true after an iteration — a
34// deterministic, code-defined exit condition.

Callers 5

FlowLoopMaxFunction · 0.92
TestLoopUntilFunction · 0.85
TestLoopMaxCapStopsFunction · 0.85
TestLoopOnIterationFunction · 0.85
TestLoopBodyErrorFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestLoopUntilFunction · 0.68
TestLoopMaxCapStopsFunction · 0.68
TestLoopOnIterationFunction · 0.68
TestLoopBodyErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…