MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Start

Method Start

internal/nodes/upgrade_manager.go:41–79  ·  view source on GitHub ↗

Start 启动升级

()

Source from the content-addressed store, hash-verified

39
40// Start 启动升级
41func (this *UpgradeManager) Start() {
42 // 必须放在文件解压之前读取可执行文件路径,防止解析之后,当前的可执行文件路径发生改变
43 exe, err := os.Executable()
44 if err != nil {
45 remotelogs.Error("UPGRADE_MANAGER", "can not find current executable file name")
46 return
47 }
48 this.exe = exe
49
50 // 测试环境下不更新
51 if Tea.IsTesting() {
52 return
53 }
54
55 if this.isInstalling {
56 return
57 }
58 this.isInstalling = true
59
60 remotelogs.Println("UPGRADE_MANAGER", "upgrading node ...")
61 err = this.install()
62 if err != nil {
63 remotelogs.Error("UPGRADE_MANAGER", "download failed: "+err.Error())
64
65 this.isInstalling = false
66 return
67 }
68
69 remotelogs.Println("UPGRADE_MANAGER", "upgrade successfully")
70
71 goman.New(func() {
72 err = this.restart()
73 if err != nil {
74 remotelogs.Error("UPGRADE_MANAGER", err.Error())
75 }
76
77 this.isInstalling = false
78 })
79}
80
81// IsInstalling 检查是否正在安装
82func (this *UpgradeManager) IsInstalling() bool {

Callers

nothing calls this directly

Calls 6

installMethod · 0.95
restartMethod · 0.95
ErrorFunction · 0.92
PrintlnFunction · 0.92
NewFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected