MCPcopy Index your code
hub / github.com/docker/docker-agent / newCooldownManager

Function newCooldownManager

pkg/runtime/cooldown_manager.go:38–46  ·  view source on GitHub ↗

newCooldownManager constructs a cooldownManager that reads time via now. Tests pass a fake clock so they can verify the eviction window without real wall-clock advancement.

(now func() time.Time)

Source from the content-addressed store, hash-verified

36// Tests pass a fake clock so they can verify the eviction window without
37// real wall-clock advancement.
38func newCooldownManager(now func() time.Time) *cooldownManager {
39 if now == nil {
40 now = time.Now
41 }
42 return &cooldownManager{
43 now: now,
44 by: make(map[string]*fallbackCooldownState),
45 }
46}
47
48// Get returns the active cooldown state for agentName, or nil when no
49// cooldown is active. Expired entries are evicted as a side-effect of the

Calls

no outgoing calls