Files
platform/web/globals/asynq.go

23 lines
333 B
Go

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)
}
}
}