mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-11 21:00:25 +08:00
节点启动错误时自动尝试从本地读取缓存数据
This commit is contained in:
@@ -83,23 +83,30 @@ func (this *Node) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 读取API配置
|
// 读取API配置
|
||||||
tryTimes := 0
|
err = this.syncConfig()
|
||||||
for {
|
if err != nil {
|
||||||
err = this.syncConfig()
|
_, err := nodeconfigs.SharedNodeConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tryTimes++
|
// 无本地数据时,会尝试多次读取
|
||||||
|
tryTimes := 0
|
||||||
|
for {
|
||||||
|
err := this.syncConfig()
|
||||||
|
if err != nil {
|
||||||
|
tryTimes++
|
||||||
|
|
||||||
if tryTimes%10 == 0 {
|
if tryTimes%10 == 0 {
|
||||||
remotelogs.Error("NODE", err.Error())
|
remotelogs.Error("NODE", err.Error())
|
||||||
}
|
}
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
// 不做长时间的无意义的重试
|
// 不做长时间的无意义的重试
|
||||||
if tryTimes > 1000 {
|
if tryTimes > 1000 {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user