refactor: streamline header and sidebar components, update navigation icons, and enhance queue management logic

This commit is contained in:
2026-03-01 03:36:14 +01:00
parent 0960f91b6f
commit d1643e9b68
8 changed files with 90 additions and 69 deletions

View File

@@ -103,7 +103,17 @@ async function findRecentActiveMatch(userId: string): Promise<string | null> {
return activeMatches[0]?.id ?? null;
}
const MAX_CONCURRENT_MATCHES = 4;
async function tryMatchFromQueue() {
// Hard cap: osu! non-bot accounts can only host a limited number of lobbies
const [{ activeCount }] = await db
.select({ activeCount: sql<number>`count(*)` })
.from(match)
.where(inArray(match.state, [MATCH_STATES.LOBBY, MATCH_STATES.ROLLING, MATCH_STATES.PICKING, MATCH_STATES.PLAYING]));
if (Number(activeCount) >= MAX_CONCURRENT_MATCHES) return null;
const queue = await db.query.matchQueue.findMany({
orderBy: asc(matchQueue.elo)
});