重构通道管理逻辑,支持通过任务删除不同类型通道;引入 Asynq 处理异步任务;更新数据库结构以支持通道类型区分
This commit is contained in:
18
web/tasks/channel.go
Normal file
18
web/tasks/channel.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/hibiken/asynq"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
const RemoveChannel = "channel:remove"
|
||||
|
||||
func NewRemoveChannel(ids []int32) *asynq.Task {
|
||||
bytes, err := json.Marshal(ids)
|
||||
if err != nil {
|
||||
slog.Error("序列化删除通道任务失败", "error", err)
|
||||
return nil
|
||||
}
|
||||
return asynq.NewTask(RemoveChannel, bytes)
|
||||
}
|
||||
Reference in New Issue
Block a user