main.go
877 字节
package main
import (
"github.com/beego/beego/v2/server/web"
service "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"
"time"
)
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 := service.NewNodeTaskService()
for {
timer := time.NewTimer(time.Second * 60)
<-timer.C
if err := nodeTaskService.SendEvaluationNode(); err != nil {
log.Logger.Error(err.Error())
}
}
}()
}