From 1025eedc22b321c38716be9d2a1ee09ffaa337f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Tue, 26 Oct 2021 22:35:38 +0200 Subject: [PATCH] inactive cursor length rewrite. --- internal/websocket/manager.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/websocket/manager.go b/internal/websocket/manager.go index 10ff58f9..ccd403c1 100644 --- a/internal/websocket/manager.go +++ b/internal/websocket/manager.go @@ -147,15 +147,12 @@ func (manager *WebSocketManagerCtx) Start() { return case <-ticker.C: cursorsMap := manager.sessions.PopCursors() - if len(cursorsMap) == 0 { - if lastEmpty { - continue - } - lastEmpty = true - } else { - lastEmpty = false + length := len(cursorsMap) + if length == 0 && lastEmpty { + continue } + lastEmpty = length == 0 cursors := []message.SessionCursor{} for session, cursor := range cursorsMap {