fix(controller): fix to the update that was blocking as it never started

This commit is contained in:
2025-09-08 16:07:16 -05:00
parent 0273703bfb
commit 19ae0d5437

View File

@@ -19,13 +19,17 @@ import (
func UpdateApp(server *socketio.Server) <-chan string { func UpdateApp(server *socketio.Server) <-chan string {
updates := make(chan string) updates := make(chan string)
rootDir := filepath.Join("..") exePath, _ := os.Executable()
exeDir := filepath.Dir(exePath)
rootDir := filepath.Join(exeDir, "..")
entries, err := os.ReadDir(rootDir) entries, err := os.ReadDir(rootDir)
if err != nil { if err != nil {
//log.Fatal("failed to read root dir: %v", err) msg := fmt.Sprintf("failed to read root dir %s: %v", rootDir, err)
updates <- msg
server.BroadcastToRoom("/", "update", "updateLogs", msg)
server.BroadcastToRoom("/", "update", "updateLogs", fmt.Sprintf("failed to read root dir: %v", err)) return updates
} }
var zips []string var zips []string
@@ -130,6 +134,8 @@ func UpdateApp(server *socketio.Server) <-chan string {
server.BroadcastToRoom("/", "update", "updateLogs", msg) server.BroadcastToRoom("/", "update", "updateLogs", msg)
} }
updates <- "done"
}() }()
return updates return updates