mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
cursors add currentEmpty.
This commit is contained in:
parent
6b77f54b8c
commit
15cb4300a5
@ -309,7 +309,8 @@ func (manager *WebSocketManagerCtx) inactiveCursors() {
|
|||||||
ticker := time.NewTicker(inactiveCursorsPeriod)
|
ticker := time.NewTicker(inactiveCursorsPeriod)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
lastEmpty := false
|
var currentEmpty bool
|
||||||
|
var lastEmpty = false
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -319,11 +320,11 @@ func (manager *WebSocketManagerCtx) inactiveCursors() {
|
|||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
cursorsMap := manager.sessions.PopCursors()
|
cursorsMap := manager.sessions.PopCursors()
|
||||||
|
|
||||||
length := len(cursorsMap)
|
currentEmpty = len(cursorsMap) == 0
|
||||||
if length == 0 && lastEmpty {
|
if currentEmpty && lastEmpty {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
lastEmpty = length == 0
|
lastEmpty = currentEmpty
|
||||||
|
|
||||||
cursors := []message.SessionCursor{}
|
cursors := []message.SessionCursor{}
|
||||||
for session, cursor := range cursorsMap {
|
for session, cursor := range cursorsMap {
|
||||||
|
Loading…
Reference in New Issue
Block a user