temp
This commit is contained in:
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"tyc-server/app/main/api/internal/config"
|
||||
"tyc-server/app/main/api/internal/handler"
|
||||
@@ -11,6 +10,7 @@ import (
|
||||
"tyc-server/app/main/api/internal/queue"
|
||||
"tyc-server/app/main/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logc"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
@@ -44,7 +44,7 @@ func main() {
|
||||
go func() {
|
||||
ctx := context.Background()
|
||||
// 初始化 cron job 或异步任务队列
|
||||
asynq := queue.NewCronJob(ctx, svcContext)
|
||||
asynq := queue.NewCronJob(&c, ctx, svcContext)
|
||||
mux := asynq.Register()
|
||||
|
||||
// 启动 asynq 消费者
|
||||
@@ -52,11 +52,7 @@ func main() {
|
||||
logx.WithContext(ctx).Errorf("异步任务启动失败: %+v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("异步任务启动!!!")
|
||||
}()
|
||||
// go func() {
|
||||
// script.RunEncryptMobile()
|
||||
// }()
|
||||
server := rest.MustNewServer(c.RestConf)
|
||||
|
||||
// 全局中间件
|
||||
@@ -66,6 +62,6 @@ func main() {
|
||||
|
||||
handler.RegisterHandlers(server, svcContext)
|
||||
|
||||
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
|
||||
logc.Info(context.Background(), "Starting server at %s:%d...", c.Host, c.Port)
|
||||
server.Start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user