MCPcopy Create free account
hub / github.com/aurora-develop/aurora / cleanupLoop

Method cleanupLoop

initialize/session_manager.go:65–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65func (sm *SessionManager) cleanupLoop() {
66 ticker := time.NewTicker(10 * time.Minute)
67 defer ticker.Stop()
68 for range ticker.C {
69 sm.mu.Lock()
70 now := time.Now()
71 removed := 0
72 for convID, entry := range sm.sessions {
73 if now.Sub(entry.lastUsed) > sm.ttl {
74 delete(sm.sessions, convID)
75 removed++
76 }
77 }
78 if removed > 0 {
79 log.Printf("[session] 清理过期 session %d 个,当前活跃 %d 个", removed, len(sm.sessions))
80 }
81 sm.mu.Unlock()
82 }
83}

Callers 1

NewSessionManagerFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected