移除多余代码
Former-commit-id: bda0bf7f31c6c6977d2c740845ddc8251f6889ee
This commit is contained in:
parent
83fa3218ab
commit
7a9578cd52
|
@ -20,15 +20,6 @@ import (
|
|||
)
|
||||
|
||||
func AddCronGroup(svc *svc.ServiceContext) {
|
||||
// 删除三天前的监控信息
|
||||
svc.Cron.AddFunc("0 0 0 ? * ? ", func() {
|
||||
ClearMetricsData(svc)
|
||||
})
|
||||
|
||||
// 同步任务信息到core端
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
SyncParticipantRpc(svc)
|
||||
})
|
||||
|
||||
svc.Cron.AddFunc("*/5 * * * * ?", func() {
|
||||
list, err := GetTaskList(svc)
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"github.com/go-redis/redis/v8"
|
||||
"github.com/go-resty/resty/v2"
|
||||
alert "github.com/prometheus/alertmanager/api/v2/client"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"gitlink.org.cn/JointCloud/pcm-ac/hpcacclient"
|
||||
|
@ -44,6 +45,7 @@ import (
|
|||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
RedisClient *redis.Client
|
||||
Cron *cron.Cron
|
||||
ModelArtsRpc modelartsservice.ModelArtsService
|
||||
ModelArtsImgRpc imagesservice.ImagesService
|
||||
DbEngin *gorm.DB
|
||||
|
@ -123,6 +125,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
|||
|
||||
return &ServiceContext{
|
||||
DbEngin: dbEngin,
|
||||
Cron: cron.New(cron.WithSeconds()),
|
||||
Config: c,
|
||||
RedisClient: redisClient,
|
||||
ModelArtsRpc: modelartsservice.NewModelArtsService(zrpc.MustNewClient(c.ModelArtsRpcConf)),
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/config"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/cron"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/mqs"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
|
@ -43,6 +44,8 @@ func main() {
|
|||
ctx := svc.NewServiceContext(c)
|
||||
// start log component
|
||||
logx.MustSetup(c.LogConf)
|
||||
ctx.Cron.Start()
|
||||
cron.AddCronGroup(ctx)
|
||||
handler.RegisterHandlers(server, ctx)
|
||||
|
||||
serviceGroup.Add(server)
|
||||
|
|
Loading…
Reference in New Issue