This commit is contained in:
2026-08-17 02:12:17 +08:00
parent 560ae46b82
commit 6a05803e08
96 changed files with 2888 additions and 685 deletions
+8 -1
View File
@@ -55,7 +55,7 @@ func (s *TaskScheduler) Start(ctx context.Context) error {
}
}
}
// GVA reports the number of rows read from the database, not only
// Report the number of rows read from the database, not only
// the enabled rows that were scheduled successfully.
s.logger.InfoContext(ctx, "定时任务加载完成", "task_count", len(items))
} else {
@@ -222,6 +222,13 @@ func (s *TaskScheduler) Subscribe(userID uint) chan []byte {
if s.subscribers[userID] == nil {
s.subscribers[userID] = map[chan []byte]struct{}{}
}
if len(s.subscribers[userID]) >= 10 {
for old := range s.subscribers[userID] {
delete(s.subscribers[userID], old)
close(old)
break
}
}
s.subscribers[userID][ch] = struct{}{}
s.subMu.Unlock()
return ch