MCPcopy Create free account
hub / github.com/compozy/agh / allow

Method allow

internal/task/force_ops.go:43–62  ·  view source on GitHub ↗
(actor ActorIdentity, taskID string, now time.Time, limit int)

Source from the content-addressed store, hash-verified

41}
42
43func (l *forceRunRateLimiter) allow(actor ActorIdentity, taskID string, now time.Time, limit int) bool {
44 if l == nil || limit <= 0 {
45 return true
46 }
47 key := string(actor.Kind.Normalize()) + ":" + strings.TrimSpace(actor.Ref) + ":" + strings.TrimSpace(taskID)
48 l.mu.Lock()
49 defer l.mu.Unlock()
50
51 window := l.windows[key]
52 if window.start.IsZero() || now.Sub(window.start) >= time.Minute {
53 l.windows[key] = forceRunRateWindow{start: now, count: 1}
54 return true
55 }
56 if window.count >= limit {
57 return false
58 }
59 window.count++
60 l.windows[key] = window
61 return true
62}
63
64// ForceReleaseRun releases one claimed run without requiring the raw claim token.
65func (m *Service) ForceReleaseRun(

Callers 1

requireForceRunRateMethod · 0.80

Calls 2

NormalizeMethod · 0.45
IsZeroMethod · 0.45

Tested by

no test coverage detected