cleanupLoop periodically removes expired sessions.
()
| 394 | |
| 395 | // cleanupLoop periodically removes expired sessions. |
| 396 | func (m *Manager) cleanupLoop() { |
| 397 | ticker := time.NewTicker(cleanupInterval) |
| 398 | defer ticker.Stop() |
| 399 | for { |
| 400 | select { |
| 401 | case <-ticker.C: |
| 402 | m.cleanup() |
| 403 | case <-m.stopCh: |
| 404 | return |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | func (m *Manager) cleanup() { |
| 410 | cutoff := time.Now().Add(-m.expiry) |