Fix race conditions and improve lifecycle safety #150

Merged
bagas merged 7 commits from refactor/lifecycle-concurrency-safety into staging 2026-07-16 17:31:15 +07:00
Showing only changes of commit 43d1ec0e6d - Show all commits
+4 -1
View File
@@ -46,7 +46,7 @@ func New(conn ssh.Conn, forwarder Forwarder, slugManager slug.Slug, port portUti
channel: nil,
forwarder: forwarder,
slug: slugManager,
startedAt: time.Now(),
startedAt: time.Time{},
sessionRegistry: sessionRegistry,
portRegistry: port,
user: user,
@@ -97,6 +97,9 @@ func (l *lifecycle) SetStatus(status types.SessionStatus) {
l.mu.Lock()
defer l.mu.Unlock()
l.status = status
if status == types.SessionStatusRUNNING && l.startedAt.IsZero() {
l.startedAt = time.Now()
}
}
func (l *lifecycle) IsActive() bool {