From 25bac8e8d8b6d40fce70a6e8c35c5e2cbbb413fa Mon Sep 17 00:00:00 2001 From: vaishnosingh Date: Wed, 14 Oct 2026 17:44:30 +0530 Subject: [PATCH] fix(orbit): sync logs header directly with DB running state --- orbitcontroller.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/orbitcontroller.go b/orbitcontroller.go index 8e58214..0aba3a2 100644 --- a/orbitcontroller.go +++ b/orbitcontroller.go @@ -512,8 +512,6 @@ func deployAppAsync(appID string) { containerID, imageTag, intPort, buildType, time.Now().Unix(), appID).Exec() saveDeploymentRecord(appID, "success", int(time.Since(startTime).Seconds()), logBuf.String()) - // Clear in-memory build log — live container logs will be served from Docker from now on - time.Sleep(2 * time.Second) // let any pending log reads finish orbitBuildLogs.Delete(appID) } @@ -833,12 +831,14 @@ func handleOrbitAppLogs(w http.ResponseWriter, r *http.Request, appID string) { w.Header().Set("X-App-Status", app.Status) // 1. If currently building: serve live in-memory build log - if val, ok := orbitBuildLogs.Load(appID); ok { - buf := val.(*bytes.Buffer) - logText := buf.String() - w.Header().Set("X-App-Status", "building") - w.Write([]byte(logText)) - return + if app.Status == "building" { + if val, ok := orbitBuildLogs.Load(appID); ok { + buf := val.(*bytes.Buffer) + logText := buf.String() + w.Header().Set("X-App-Status", "building") + w.Write([]byte(logText)) + return + } } // 2. If running: stream live container stdout/stderr