add EngineDelay

This commit is contained in:
UlricQin 2021-12-01 14:09:08 +08:00
parent 57c2fd9b73
commit 11e7c41908
3 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,9 @@ RunMode = "release"
# my cluster name
ClusterName = "Default"
# sleep x seconds, then start judge engine
EngineDelay = 120
[Log]
# log write dir
Dir = "logs"

View File

@ -62,6 +62,10 @@ func MustLoad(fpaths ...string) {
}
m.MustLoad(C)
if C.EngineDelay == 0 {
C.EngineDelay = 120
}
if C.Heartbeat.IP == "" {
// auto detect
C.Heartbeat.IP = fmt.Sprint(GetOutboundIP())
@ -85,6 +89,7 @@ func MustLoad(fpaths ...string) {
type Config struct {
RunMode string
ClusterName string
EngineDelay int64
Log logx.Config
HTTP httpx.Config
BasicAuth gin.Accounts

View File

@ -20,7 +20,7 @@ import (
func loopFilterRules(ctx context.Context) {
// wait for samples
time.Sleep(time.Minute * 2)
time.Sleep(time.Duration(config.C.EngineDelay) * time.Second)
duration := time.Duration(9000) * time.Millisecond
for {