From 6b745a056fb74c127d081b6e1684e13b72130d69 Mon Sep 17 00:00:00 2001 From: Azareal Date: Mon, 4 Nov 2019 17:00:12 +1000 Subject: [PATCH] Terminate this loop earlier. --- common/ws_hub.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/ws_hub.go b/common/ws_hub.go index 1c4594cc..588ab3dd 100644 --- a/common/ws_hub.go +++ b/common/ws_hub.go @@ -105,6 +105,7 @@ func wsTopicListTick(h *WsHubImpl) error { if !tItem.Sticky { if tItem.ID != h.lastTopicList[j].ID || !tItem.LastReplyAt.Equal(h.lastTopicList[j].LastReplyAt) { hasItem = true + break } } } @@ -237,7 +238,7 @@ func (h *WsHubImpl) HasUser(uid int) (exists bool) { if exists { return exists } - + h.oddUserLock.RLock() _, exists = h.oddOnlineUsers[uid] h.oddUserLock.RUnlock()