Implement queue timeout #45 (#71)

### Description

This PR implements a queue timeout in the lobby server.

* After the time configured in `timeout` has elapsed (default: 3 minutes) since the first player joins the queue, matchmaking will start even if the queue has not reached the `players_per_game` target. Any missing slots will be filled with fake players.
* If the first queued player leaves and other players remain, the timer is recalculated so that matchmaking starts after the `timeout` duration (default: 3 minutes) from the next player’s join time. (After that, the timer continues to be adjusted in the same way whenever the head of the queue changes.)

### Game

Robocraft

### Please confirm

- [x] I am the legal owner or represent the owner of all work submitted
- [x] I consent to my submission being added to this FOSS project
- [x] This PR used LLMs to generate some or all of the code changes

Reviewed-on: https://git.ngram.ca/OpenJam/rc-servers/pulls/71
Reviewed-by: NGnius <ngniusness@gmail.com>
Co-authored-by: MaxSignal <kastera58@gmail.com>
Co-committed-by: MaxSignal <kastera58@gmail.com>
This commit is contained in:
MaxSignal authored and NGnius committed 2026-01-08 02:17:34 +00:00
1 parent ac9e2a9fcd
commit d2c68bf7dd
7 files changed
+149 -16

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@ async fn process_socket(mut socket: net::TcpStream, address: std::net::SocketAdd
let ctx = polariton::packet::SerdesContext::from_boxed(Default::default(), enc);
server.handle_async_with_channel_join(socket_r, socket_w, user_state.clone(), ctx, chann_tx, chann_rx).await;
if let Ok(user_info) = user_state.user() {
queue.leave_queue(user_info.as_ref().as_ref()).await;
queue.leave_queue(user_info.clone()).await;
} else {
log::debug!("Unauthenticated user disconnected");
}