add EngineDelay
This commit is contained in:
parent
57c2fd9b73
commit
11e7c41908
|
@ -4,6 +4,9 @@ RunMode = "release"
|
||||||
# my cluster name
|
# my cluster name
|
||||||
ClusterName = "Default"
|
ClusterName = "Default"
|
||||||
|
|
||||||
|
# sleep x seconds, then start judge engine
|
||||||
|
EngineDelay = 120
|
||||||
|
|
||||||
[Log]
|
[Log]
|
||||||
# log write dir
|
# log write dir
|
||||||
Dir = "logs"
|
Dir = "logs"
|
||||||
|
|
|
@ -62,6 +62,10 @@ func MustLoad(fpaths ...string) {
|
||||||
}
|
}
|
||||||
m.MustLoad(C)
|
m.MustLoad(C)
|
||||||
|
|
||||||
|
if C.EngineDelay == 0 {
|
||||||
|
C.EngineDelay = 120
|
||||||
|
}
|
||||||
|
|
||||||
if C.Heartbeat.IP == "" {
|
if C.Heartbeat.IP == "" {
|
||||||
// auto detect
|
// auto detect
|
||||||
C.Heartbeat.IP = fmt.Sprint(GetOutboundIP())
|
C.Heartbeat.IP = fmt.Sprint(GetOutboundIP())
|
||||||
|
@ -85,6 +89,7 @@ func MustLoad(fpaths ...string) {
|
||||||
type Config struct {
|
type Config struct {
|
||||||
RunMode string
|
RunMode string
|
||||||
ClusterName string
|
ClusterName string
|
||||||
|
EngineDelay int64
|
||||||
Log logx.Config
|
Log logx.Config
|
||||||
HTTP httpx.Config
|
HTTP httpx.Config
|
||||||
BasicAuth gin.Accounts
|
BasicAuth gin.Accounts
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
func loopFilterRules(ctx context.Context) {
|
func loopFilterRules(ctx context.Context) {
|
||||||
// wait for samples
|
// wait for samples
|
||||||
time.Sleep(time.Minute * 2)
|
time.Sleep(time.Duration(config.C.EngineDelay) * time.Second)
|
||||||
|
|
||||||
duration := time.Duration(9000) * time.Millisecond
|
duration := time.Duration(9000) * time.Millisecond
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Reference in New Issue