...
|
...
|
@@ -8,6 +8,7 @@ import ( |
|
|
"github.com/beego/beego/v2/server/web"
|
|
|
serviceTask "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/node_task"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify"
|
|
|
serviceSummary "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
|
|
|
_ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/consumer"
|
...
|
...
|
@@ -16,6 +17,7 @@ import ( |
|
|
func main() {
|
|
|
startNodeTask()
|
|
|
startSummaryEvaluation()
|
|
|
go notify.RunTaskSmsNotify()
|
|
|
go consumer.Run()
|
|
|
web.Run()
|
|
|
}
|
...
|
...
|
@@ -44,5 +46,20 @@ func startNodeTask() { |
|
|
|
|
|
// 定时任务-间隔检查时间,发送周期评估
|
|
|
func startSummaryEvaluation() {
|
|
|
go notify.RunTaskSmsNotify()
|
|
|
go func() {
|
|
|
var duration time.Duration
|
|
|
if constant.Env == "prd" {
|
|
|
duration = time.Minute * 5
|
|
|
} else {
|
|
|
duration = time.Minute * 1
|
|
|
}
|
|
|
timer := time.NewTimer(duration)
|
|
|
for {
|
|
|
<-timer.C
|
|
|
if err := serviceSummary.TaskSendSummaryEvaluation(); err != nil {
|
|
|
log.Logger.Error(err.Error())
|
|
|
}
|
|
|
timer.Reset(duration) // 重置定时
|
|
|
}
|
|
|
}()
|
|
|
} |
...
|
...
|
|