diff --git a/plugin/server/store.go b/plugin/server/store.go index 0c04f32..9a0ac72 100644 --- a/plugin/server/store.go +++ b/plugin/server/store.go @@ -146,6 +146,18 @@ func (s *Store) CleanStaleSessions(staleThresholdMs, expireThresholdMs int64) (c lastUpdate = session.StartTimeMs } if lastUpdate == 0 { + // No timestamps at all (pre-cleanup era orphan) — treat as expired immediately. + // Delete non-active sessions; mark active ones as interrupted so they get + // picked up on the next cleanup cycle with a real timestamp. + if session.Status == "active" { + session.Status = "interrupted" + session.LastUpdateMs = now + _ = s.SaveSession(session.SessionKey, session) + cleaned++ + } else { + _ = s.DeleteSession(session.SessionKey) + expired++ + } continue } age := now - lastUpdate