file: add taskqueue worker process image thumbnail
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 30s

This commit is contained in:
2025-06-02 22:09:53 +08:00
parent 0d65a890f6
commit cd4079c24d
9 changed files with 569 additions and 50 deletions

View File

@ -8,6 +8,7 @@ import (
"godemo/file/internal/config"
"godemo/file/internal/server"
"godemo/file/internal/svc"
"godemo/file/worker"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
@ -25,6 +26,11 @@ func main() {
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)
// 初始化任务队列
worker.InitImageProcessTaskQueue(1000)
// 启动worker池
worker.StartImageProcessWorkers(5, ctx)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
file.RegisterFileServer(grpcServer, server.NewFileServer(ctx))