mirror of https://github.com/jetkvm/kvm.git
Compare commits
1 Commits
50e1cf06b8
...
7c3ee67087
| Author | SHA1 | Date |
|---|---|---|
|
|
7c3ee67087 |
|
|
@ -1252,11 +1252,19 @@ func (sm *SessionManager) transferPrimaryRole(fromSessionID, toSessionID, transf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grace periods are cleared for demoted sessions (line 519-520) to prevent them from
|
// DON'T clear grace periods during transfers!
|
||||||
// auto-reclaiming primary after manual transfer. New grace periods are created when
|
// Grace periods and blacklisting serve different purposes:
|
||||||
// sessions reconnect via RemoveSession. The blacklist provides additional protection
|
// - Grace periods: Allow disconnected sessions to reconnect and reclaim their role
|
||||||
// during the transfer window, while lastPrimaryID allows the newly promoted session
|
// - Blacklisting: Prevent recently demoted sessions from immediately taking primary again
|
||||||
// to safely handle browser refreshes and reclaim primary if disconnected.
|
//
|
||||||
|
// When a primary session is transferred to another session:
|
||||||
|
// 1. The newly promoted session should be able to refresh its browser without losing primary
|
||||||
|
// 2. When it refreshes, RemoveSession is called, which adds a grace period
|
||||||
|
// 3. When it reconnects, it should find itself in lastPrimaryID and reclaim primary
|
||||||
|
//
|
||||||
|
// The blacklist prevents the OLD primary from immediately reclaiming control,
|
||||||
|
// while the grace period allows the NEW primary to safely refresh its browser.
|
||||||
|
// These mechanisms complement each other and should not interfere.
|
||||||
|
|
||||||
sm.logger.Info().
|
sm.logger.Info().
|
||||||
Str("fromSessionID", fromSessionID).
|
Str("fromSessionID", fromSessionID).
|
||||||
|
|
@ -1565,11 +1573,6 @@ func (sm *SessionManager) broadcastSessionListUpdate() {
|
||||||
select {
|
select {
|
||||||
case sm.broadcastQueue <- struct{}{}:
|
case sm.broadcastQueue <- struct{}{}:
|
||||||
default:
|
default:
|
||||||
sm.logger.Warn().
|
|
||||||
Int("queueLen", len(sm.broadcastQueue)).
|
|
||||||
Int("queueCap", cap(sm.broadcastQueue)).
|
|
||||||
Msg("Broadcast queue full, dropping update")
|
|
||||||
sm.broadcastPending.Store(false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue