skipRecord returns true when the user is still in the retry cooldown window and we should skip a DB write attempt.
(userID uuid.UUID, now time.Time)
| 54 | // skipRecord returns true when the user is still in the retry cooldown |
| 55 | // window and we should skip a DB write attempt. |
| 56 | func (t *SeatTracker) skipRecord(userID uuid.UUID, now time.Time) bool { |
| 57 | t.mu.RLock() |
| 58 | defer t.mu.RUnlock() |
| 59 | |
| 60 | retryAfter, ok := t.retryAfter[userID] |
| 61 | return ok && now.Before(retryAfter) |
| 62 | } |
| 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) { |