From fe5cfeb12a714793a8b69804ad6decdd54c7cbeb Mon Sep 17 00:00:00 2001 From: naiba Date: Mon, 30 Nov 2020 13:22:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20auto=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/agent/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 30133fb..e76c753 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -25,7 +25,7 @@ var ( server string clientSecret string debug bool - version string + version string = "0.1.4" rootCmd = &cobra.Command{ Use: "nezha-agent", @@ -41,10 +41,11 @@ var ( func doSelfUpdate() { defer func() { - time.Sleep(time.Minute * 20) + time.Sleep(time.Second * 3) updateCh <- struct{}{} }() v := semver.MustParse(version) + log.Println("check update", v) latest, err := selfupdate.UpdateSelf(v, "naiba/nezha") if err != nil { log.Println("Binary update failed:", err) @@ -94,8 +95,7 @@ func run(cmd *cobra.Command, args []string) { go func() { for range updateCh { - log.Println("check update", version) - doSelfUpdate() + go doSelfUpdate() } }()