重构通道管理逻辑,支持通过任务删除不同类型通道;引入 Asynq 处理异步任务;更新数据库结构以支持通道类型区分

This commit is contained in:
2025-05-23 14:53:01 +08:00
parent 09a9cc573e
commit c83ffda611
17 changed files with 380 additions and 188 deletions

22
web/globals/asynq.go Normal file
View File

@@ -0,0 +1,22 @@
package globals
import (
"github.com/hibiken/asynq"
"log/slog"
)
var Asynq *asynq.Client
func InitAsynq() {
var client = asynq.NewClientFromRedisClient(Redis)
Asynq = client
}
func CloseAsynq() {
if Asynq != nil {
err := Asynq.Close()
if err != nil {
slog.Error("关闭 Asynq 客户端失败", "error", err)
}
}
}