main.go
885 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"time"
"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/log"
_ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/consumer"
)
func main() {
startNodeTask()
// tree := web.PrintTree()
// methods := tree["Data"].(web.M)
// for k, v := range methods {
// fmt.Printf("%s => %v \n", k, v)
// }
go consumer.Run()
web.Run()
}
// 定时任务-间隔发送评估环节
func startNodeTask() {
go func() {
nodeTaskService := serviceTask.NewNodeTaskService()
for {
timer := time.NewTimer(time.Minute * 5)
<-timer.C
if err := nodeTaskService.SendEvaluationNode(); err != nil {
log.Logger.Error(err.Error())
}
}
}()
}