fix: prevent timeout ping-pong loop in emergency promotions

This commit is contained in:
Alex P 2025-10-23 18:47:28 +03:00
parent 906c5cf4b7
commit d7a37b5eb3
1 changed files with 3 additions and 3 deletions

View File

@ -1223,11 +1223,11 @@ func (sm *SessionManager) transferPrimaryRole(fromSessionID, toSessionID, transf
return fmt.Errorf("cannot promote: another primary session exists (%s)", existingPrimaryID) return fmt.Errorf("cannot promote: another primary session exists (%s)", existingPrimaryID)
} }
// Promote target session
toSession.Mode = SessionModePrimary toSession.Mode = SessionModePrimary
toSession.hidRPCAvailable = false toSession.hidRPCAvailable = false
// For manual transfers, preserve the session's actual LastActive timestamp if transferType == "emergency_timeout_promotion" {
// Emergency promotions inherit the observer's activity state - no free time toSession.LastActive = time.Now()
}
sm.primarySessionID = toSessionID sm.primarySessionID = toSessionID
// ALWAYS set lastPrimaryID to the new primary to support WebRTC reconnections // ALWAYS set lastPrimaryID to the new primary to support WebRTC reconnections