正在显示
4 个修改的文件
包含
19 行增加
和
1 行删除
@@ -60,6 +60,8 @@ spec: | @@ -60,6 +60,8 @@ spec: | ||
60 | value: "debug" | 60 | value: "debug" |
61 | - name: LOG_FILE | 61 | - name: LOG_FILE |
62 | value: "true" | 62 | value: "true" |
63 | + - name: ENV_MOD | ||
64 | + value: "prd" | ||
63 | - name: ERROR_BASE_CODE | 65 | - name: ERROR_BASE_CODE |
64 | value: "1" | 66 | value: "1" |
65 | - name: ERROR_BASE_CODE_MULTIPLE | 67 | - name: ERROR_BASE_CODE_MULTIPLE |
@@ -60,6 +60,8 @@ spec: | @@ -60,6 +60,8 @@ spec: | ||
60 | value: "debug" | 60 | value: "debug" |
61 | - name: LOG_FILE | 61 | - name: LOG_FILE |
62 | value: "true" | 62 | value: "true" |
63 | + - name: ENV_MOD | ||
64 | + value: "test" | ||
63 | - name: ERROR_BASE_CODE | 65 | - name: ERROR_BASE_CODE |
64 | value: "1" | 66 | value: "1" |
65 | - name: ERROR_BASE_CODE_MULTIPLE | 67 | - name: ERROR_BASE_CODE_MULTIPLE |
1 | package main | 1 | package main |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" | ||
4 | "time" | 5 | "time" |
5 | 6 | ||
6 | "github.com/beego/beego/v2/server/web" | 7 | "github.com/beego/beego/v2/server/web" |
@@ -27,7 +28,13 @@ func startNodeTask() { | @@ -27,7 +28,13 @@ func startNodeTask() { | ||
27 | go func() { | 28 | go func() { |
28 | nodeTaskService := serviceTask.NewNodeTaskService() | 29 | nodeTaskService := serviceTask.NewNodeTaskService() |
29 | for { | 30 | for { |
30 | - timer := time.NewTimer(time.Minute * 5) | 31 | + var duration time.Duration |
32 | + if constant.Env == "prd" { | ||
33 | + duration = time.Minute * 5 | ||
34 | + } else { | ||
35 | + duration = time.Minute * 1 | ||
36 | + } | ||
37 | + timer := time.NewTimer(duration) | ||
31 | <-timer.C | 38 | <-timer.C |
32 | if err := nodeTaskService.SendEvaluationNode(); err != nil { | 39 | if err := nodeTaskService.SendEvaluationNode(); err != nil { |
33 | log.Logger.Error(err.Error()) | 40 | log.Logger.Error(err.Error()) |
@@ -11,8 +11,15 @@ var AdminJwtExpiresIn = int64(3600 * 24 * 7) | @@ -11,8 +11,15 @@ var AdminJwtExpiresIn = int64(3600 * 24 * 7) | ||
11 | 11 | ||
12 | var AdminJWTSecretKey = "sg-storage" | 12 | var AdminJWTSecretKey = "sg-storage" |
13 | 13 | ||
14 | +// Env 判断当前环境变量 | ||
15 | +var Env = "dev" | ||
16 | + | ||
14 | func init() { | 17 | func init() { |
15 | if os.Getenv("LOG_LEVEL") != "" { | 18 | if os.Getenv("LOG_LEVEL") != "" { |
16 | LOG_LEVEL = os.Getenv("LOG_LEVEL") | 19 | LOG_LEVEL = os.Getenv("LOG_LEVEL") |
17 | } | 20 | } |
21 | + | ||
22 | + if os.Getenv("ENV_MOD") != "" { | ||
23 | + Env = os.Getenv("ENV_MOD") | ||
24 | + } | ||
18 | } | 25 | } |
-
请 注册 或 登录 后发表评论