fix(controller): fix to the update that was blocking as it never started
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user