lastEmpty session cursors.

This commit is contained in:
Miroslav Šedivý 2021-10-26 21:07:57 +02:00
parent 0b5e064cab
commit 78e4c38264

View File

@ -139,6 +139,8 @@ func (manager *WebSocketManagerCtx) Start() {
ticker := time.NewTicker(500 * time.Millisecond) ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop() defer ticker.Stop()
lastEmpty := false
for { for {
select { select {
case <-manager.shutdown: case <-manager.shutdown:
@ -146,7 +148,13 @@ func (manager *WebSocketManagerCtx) Start() {
case <-ticker.C: case <-ticker.C:
cursorsMap := manager.sessions.PopCursors() cursorsMap := manager.sessions.PopCursors()
if len(cursorsMap) == 0 { if len(cursorsMap) == 0 {
continue if lastEmpty {
continue
}
lastEmpty = true
} else {
lastEmpty = false
} }
cursors := []message.SessionCursor{} cursors := []message.SessionCursor{}