fix: session persistence across restart

Shutdown() was calling KillSession() which deleted the persisted
JSON files immediately after saveAllSessions() wrote them. Now
Shutdown() closes sessions directly without removing persistence
files, allowing restoreAllSessions() to find them on next start.
This commit is contained in:
Levi Neely 2026-07-18 16:28:12 +02:00
parent aa467e9b3c
commit 9d21601edf
1 changed files with 9 additions and 1 deletions

View File

@ -803,7 +803,15 @@ func (s *Manager) Shutdown() {
}
s.mu.Unlock()
for _, id := range ids {
s.KillSession(id)
s.mu.Lock()
sess := s.sessions[id]
delete(s.sessions, id)
s.mu.Unlock()
if sess != nil {
sess.Cancel()
sess.Core.Close()
s.cfg.Log.Info("shutdown session %s", id)
}
}
}