reduce gc time and improve unreachable session detection
All checks were successful
Build and Test / minecraft-wiiu (push) Successful in 3m19s
Build and Test / sonic-transformed (push) Successful in 4m5s
Build and Test / wii-u-chat (push) Successful in 4m42s
Build and Test / puyopuyo (push) Successful in 5m13s
Build and Test / splatoon (push) Successful in 5m20s
Build and Test / splatoon-testfire (push) Successful in 5m38s
Build and Test / mario-tennis (push) Successful in 5m41s
Build and Test / super-mario-maker (push) Successful in 6m44s
Build and Test / friends (push) Successful in 6m58s
Build and Test / wii-sports-club (push) Successful in 7m21s
Build and Test / fast-racing-neo (push) Successful in 7m26s

This commit is contained in:
Maple Nebel 2026-05-31 16:47:01 +02:00
commit f51fc3a1db
2 changed files with 8 additions and 10 deletions

View file

@ -95,8 +95,8 @@ impl MatchmakeManager {
while let Some(this) = this.upgrade() {
this.garbage_collect().await;
// every 30 minutes
sleep(Duration::from_secs(60 * 30)).await;
// every 5 minutes
sleep(Duration::from_secs(60 * 5)).await;
}
});
}
@ -300,12 +300,12 @@ impl ExtendedMatchmakeSession {
}
}
pub fn has_active_players(&self) -> bool {
pub fn has_min_active_players(&self) -> bool {
self.connected_players
.iter()
.filter(|v| v.upgrade().is_some())
.count()
!= 0
>= self.session.gathering.minimum_participants as _
}
#[inline]
@ -313,14 +313,14 @@ impl ExtendedMatchmakeSession {
self.get_active_players()
.any(|v| v.pid == self.session.gathering.host_pid)
&& (if self.session.gathering.flags & PERSISTENT_GATHERING != 0 {
if self.has_active_players() {
if self.has_min_active_players() {
true
} else {
self.session.open_participation
}
} else {
self.has_active_players()
}) & self.has_active_players()
self.has_min_active_players()
}) & self.has_min_active_players()
}
#[inline]
pub fn is_joinable(&self) -> bool {

View file

@ -342,12 +342,10 @@ impl MatchmakeExtension for User {
let sessions = self.matchmake_manager.sessions.read().await;
for session in sessions.values() {
let mut session = session.lock().await;
println!("checking session!");
if !session.is_joinable() {
continue;
}
println!("checking session!");
let mut bool_matched_criteria = false;