优化代码/增加edge-api goman命令

This commit is contained in:
GoEdgeLab
2021-12-14 10:49:29 +08:00
parent 0646d474a9
commit 515ead530d
54 changed files with 383 additions and 131 deletions

View File

@@ -2,6 +2,7 @@ package tasks
import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
"github.com/TeaOSLab/EdgeAPI/internal/goman"
"github.com/TeaOSLab/EdgeAPI/internal/utils/numberutils"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
@@ -11,17 +12,17 @@ import (
)
func init() {
dbs.OnReady(func() {
dbs.OnReadyDone(func() {
task := NewNSNodeMonitorTask(60)
ticker := time.NewTicker(60 * time.Second)
go func() {
goman.New(func() {
for range ticker.C {
err := task.loop()
if err != nil {
logs.Println("[TASK][NS_NODE_MONITOR]" + err.Error())
}
}
}()
})
})
}