session: follow PersistedSession → PersistedAgent rename
This commit is contained in:
parent
c07aef6bb9
commit
1ce845e83f
|
|
@ -37,7 +37,7 @@ func (s *Manager) persistSession(id string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Manager) removePersistedSession(id string) {
|
func (s *Manager) removePersistedAgent(id string) {
|
||||||
path := filepath.Join(s.activeSessionsDir(), id+".json")
|
path := filepath.Join(s.activeSessionsDir(), id+".json")
|
||||||
os.Remove(path)
|
os.Remove(path)
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ func (s *Manager) restoreAllSessions() {
|
||||||
|
|
||||||
// Load all persisted session JSONs (fast, sequential disk reads)
|
// Load all persisted session JSONs (fast, sequential disk reads)
|
||||||
type loadedSession struct {
|
type loadedSession struct {
|
||||||
ps *agent.PersistedSession
|
ps *agent.PersistedAgent
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
var loaded []loadedSession
|
var loaded []loadedSession
|
||||||
|
|
@ -72,7 +72,7 @@ func (s *Manager) restoreAllSessions() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
path := filepath.Join(dir, e.Name())
|
path := filepath.Join(dir, e.Name())
|
||||||
ps, err := agent.LoadPersistedSession(path)
|
ps, err := agent.LoadPersistedAgent(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.cfg.Log.Error("restore session %s: %v", e.Name(), err)
|
s.cfg.Log.Error("restore session %s: %v", e.Name(), err)
|
||||||
continue
|
continue
|
||||||
|
|
@ -98,7 +98,7 @@ func (s *Manager) restoreAllSessions() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Manager) restoreSession(ps *agent.PersistedSession) error {
|
func (s *Manager) restoreSession(ps *agent.PersistedAgent) error {
|
||||||
cwd := ps.CWD
|
cwd := ps.CWD
|
||||||
if cwd == "" {
|
if cwd == "" {
|
||||||
cwd, _ = os.Getwd()
|
cwd, _ = os.Getwd()
|
||||||
|
|
@ -312,7 +312,7 @@ func (s *Manager) KillSession(id string) {
|
||||||
if sess != nil {
|
if sess != nil {
|
||||||
sess.Cancel()
|
sess.Cancel()
|
||||||
sess.Core.Close()
|
sess.Core.Close()
|
||||||
s.removePersistedSession(id)
|
s.removePersistedAgent(id)
|
||||||
s.cfg.Log.Info("killed session %s", id)
|
s.cfg.Log.Info("killed session %s", id)
|
||||||
if s.cfg.OnSessionKilled != nil {
|
if s.cfg.OnSessionKilled != nil {
|
||||||
s.cfg.OnSessionKilled(id)
|
s.cfg.OnSessionKilled(id)
|
||||||
|
|
|
||||||
Reference in New Issue