MCPcopy Create free account
hub / github.com/coder/coder / recordThrottle

Method recordThrottle

enterprise/aiseats/tracker.go:65–69  ·  view source on GitHub ↗

recordThrottle sets the next time when DB writes for this user are allowed.

(userID uuid.UUID, now time.Time, d time.Duration)

Source from the content-addressed store, hash-verified

63
64// recordThrottle sets the next time when DB writes for this user are allowed.
65func (t *SeatTracker) recordThrottle(userID uuid.UUID, now time.Time, d time.Duration) {
66 t.mu.Lock()
67 defer t.mu.Unlock()
68 t.retryAfter[userID] = now.Add(d)
69}
70
71// RecordUsage will record the AI seat usage for the user. There is a race condition between
72// checking if the user should be recorded or throttled and actually recording. This is fine, as

Callers 1

RecordUsageMethod · 0.95

Implementers 2

Noopcoderd/aiseats/aiseats.go
SeatTrackerenterprise/aiseats/tracker.go

Calls 3

AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected