MCPcopy
hub / github.com/mudler/LocalAI / cleanupLoop

Method cleanupLoop

core/http/auth/quota.go:297–315  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

295}
296
297func (c *quotaCacheStore) cleanupLoop() {
298 ticker := time.NewTicker(60 * time.Second)
299 defer ticker.Stop()
300 for range ticker.C {
301 c.mu.Lock()
302 now := time.Now()
303 for k, v := range c.rules {
304 if now.Sub(v.fetchedAt) > rulesCacheTTL*2 {
305 delete(c.rules, k)
306 }
307 }
308 for k, v := range c.usage {
309 if now.Sub(v.fetchedAt) > usageCacheTTL*2 {
310 delete(c.usage, k)
311 }
312 }
313 c.mu.Unlock()
314 }
315}
316
317// ── Helpers ──
318

Callers 1

newQuotaCacheStoreFunction · 0.95

Calls 4

deleteFunction · 0.85
StopMethod · 0.65
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected