feat: implement time wheel for scheduling tasks and refactor bond and steam playing checks to use new task scheduling utility

This commit is contained in:
lixiangwuxian
2025-01-10 01:27:50 +08:00
parent fa635ad9f1
commit 8dcef53924
3 changed files with 197 additions and 12 deletions

View File

@@ -176,11 +176,11 @@ func checkSteamPlaying(msg model.Message) model.Reply {
func RoundCheckSteamPlaying() {
once := true
playingMap := map[int64]map[string]string{}
for {
util.AddCycleTask("checkSteamPlaying", 15*time.Second, 15*time.Second, func() {
groups, err := getAllGroupID()
if err != nil {
fmt.Println("获取群列表失败: ", err)
continue
return
}
for _, group := range groups {
@@ -212,5 +212,5 @@ func RoundCheckSteamPlaying() {
}
}
once = false
}
})
}