fix(server): coalesce platform evict fanout

This commit is contained in:
richjohnrambo
2026-10-08 00:23:12 +08:00
parent e30b70a3a7
commit f24133f5de
3 changed files with 145 additions and 19 deletions
+4 -1
View File
@@ -338,7 +338,7 @@ func (ss *SessionStore) Shutdown() {
}
// EvictUser terminates all sessions of a given user.
func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string, reason ...string) {
func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string, reason ...string) int {
ss.lock.Lock()
defer ss.lock.Unlock()
@@ -348,6 +348,7 @@ func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string, reason ...strin
if len(reason) > 0 && reason[0] != "" {
evicted.Ctrl.Params = map[string]any{"reason": reason[0]}
}
count := 0
for _, s := range ss.sessCache {
if s.uid == uid && !s.isMultiplex() && s.sid != skipSid {
_, data := s.serialize(evicted)
@@ -356,10 +357,12 @@ func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string, reason ...strin
if s.proto == LPOLL {
ss.lru.Remove(s.lpTracker)
}
count++
}
}
statsSet("LiveSessions", int64(len(ss.sessCache)))
return count
}
// EvictUserDevice terminates all sessions of a given user connected with a device.