任务调度update

This commit is contained in:
2023-01-18 14:53:01 +08:00
parent 0dfc11c113
commit 12473fd656
6 changed files with 57 additions and 67 deletions
+8 -22
View File
@@ -3,6 +3,7 @@ package main
// init函数执行顺序自上而下, 最后执行main包里面的init函数
import (
_ "cutego/core/dao"
_ "cutego/core/job"
"cutego/core/router"
"cutego/pkg/common"
"cutego/pkg/config"
@@ -14,29 +15,8 @@ import (
)
func main() {
StartTest()
StartApp()
}
func StartTest() {
fmt.Println("================ Test Content =================")
//go testChangeJob()
//cronjob.PrintCronNext()
//cronjob.ExecWithCronNext()
fmt.Println("================ Test Content =================")
}
func StartApp() {
//switch config.AppEnvConfig.Server.RunMode {
//case gin.DebugMode:
// gin.SetMode(gin.DebugMode)
// break
//case gin.ReleaseMode:
// gin.SetMode(gin.ReleaseMode)
// break
//default:
// gin.SetMode(gin.DebugMode)
//}
gin.SetMode(util.IF(config.AppEnvConfig.Server.RunMode == "", "debug", config.AppEnvConfig.Server.RunMode).(string))
r := router.Init()
r.Use(logger.LoggerToFile())
@@ -45,3 +25,9 @@ func StartApp() {
common.FatalfLog("Start server: %+v", err)
}
}
//func testChangeJob() {
// time.Sleep(time.Millisecond * 5000)
// fmt.Println("改变任务调度间隔")
// cronjob.AppendCronFunc("*/5 * * * *", "test1", "1")
//}