mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-10 20:40:56 +08:00
实现基础的智能调度
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -66,7 +67,7 @@ func (this *HealthCheckExecutor) Run() ([]*HealthCheckResult, error) {
|
||||
|
||||
var tx *dbs.Tx
|
||||
for _, node := range nodes {
|
||||
if !node.IsOn {
|
||||
if !node.IsOn || node.IsBackupForCluster || node.IsBackupForGroup || (len(node.OfflineDay) > 0 && node.OfflineDay < timeutil.Format("Ymd")) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -194,6 +195,15 @@ func (this *HealthCheckExecutor) runNode(healthCheckConfig *serverconfigs.Health
|
||||
this.logErr("HealthCheckExecutor", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 触发节点动作
|
||||
if !result.IsOk {
|
||||
err := this.fireNodeActions(int64(result.Node.Id))
|
||||
if err != nil {
|
||||
this.logErr("HealthCheckExecutor", err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 触发阈值
|
||||
|
||||
Reference in New Issue
Block a user