perf(日志): 空轮询时不输出 Info 日志以减少噪音
Motivation: 轮询安全网关更新时,绝大多数周期没有新消息,持续输出 Info 日志会产生大量噪音并带来不必要的开销。仅在确有更新时才记录日志,便于聚焦真实事件。 Changes: * 仅在存在更新时输出 getUpdates 日志 * 仅在拉取到群聊数据时输出 poll 日志
This commit is contained in:
@@ -178,7 +178,9 @@ func (s *SafeWSender) PollGroupChats(token string, offset int64, timeout int) ([
|
||||
if maxID > 0 {
|
||||
next = maxID + 1
|
||||
}
|
||||
if n > 0 {
|
||||
slog.Info("safew getUpdates", "timeout", timeout, "updates", n, "groups", len(chats), "offset", next)
|
||||
}
|
||||
return chats, next, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,9 @@ func (w *Watcher) pollOnce(ctx context.Context, token string, timeout int) error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(chats) > 0 {
|
||||
slog.Info("safew poll", "timeout", timeout, "groups", len(chats), "offset", next)
|
||||
}
|
||||
if err := w.mergeAndLog(ctx, token, chats); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user