recordThrottle sets the next time when DB writes for this user are allowed.
(userID uuid.UUID, now time.Time, d time.Duration)
| 63 | |
| 64 | // recordThrottle sets the next time when DB writes for this user are allowed. |
| 65 | func (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 |
no test coverage detected