Skip to content

Commit

Permalink
💩 fix self update, go-update could not restart it-self
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Nov 30, 2020
1 parent 286e174 commit fe3b962
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ var (
updateCh = make(chan struct{}, 0)
)

const AGENT_UPGRADE = 55

func doSelfUpdate() {
defer func() {
time.Sleep(time.Minute * 20)
Expand All @@ -64,10 +66,8 @@ func doSelfUpdate() {
// latest version is the same as current version. It means current binary is up to date.
log.Println("Current binary is the latest version", version)
} else {
log.Println("Prev version", dao.Version)
dao.Version = latest.Version.String()
client.Register(ctx, monitor.GetHost().PB())
log.Println("Successfully updated to version", latest.Version)
os.Exit(AGENT_UPGRADE)
}
}

Expand Down

0 comments on commit fe3b962

Please sign in to comment.