fix(multi): prevent host pruning and increase timeout to 90s
- Exempt host from inactivity pruning to prevent room corruption - Increase player timeout from 45s to 90s for slower connections - Reduce heartbeat interval from 20s to 15s for better coverage - Refresh all players' lastSeen on nextRound/resetGame to avoid immediate pruning
This commit is contained in:
+10
-10
@@ -1,16 +1,16 @@
|
||||
export type Badge = { name: string; file: string; threshold: number };
|
||||
|
||||
export const BADGES: Badge[] = [
|
||||
{ name: "Omniscient", file: "omniscient", threshold: 10000 },
|
||||
{ name: "Transcendant", file: "transcendant", threshold: 5000 },
|
||||
{ name: "Mythique", file: "mythique", threshold: 2500 },
|
||||
{ name: "Légende", file: "légende", threshold: 1000 },
|
||||
{ name: "Maître", file: "maître", threshold: 500 },
|
||||
{ name: "Expert", file: "expert", threshold: 150 },
|
||||
{ name: "Adepte", file: "adepte", threshold: 50 },
|
||||
{ name: "Initié", file: "initié", threshold: 20 },
|
||||
{ name: "Apprenti", file: "apprenti", threshold: 5 },
|
||||
{ name: "Novice", file: "novice", threshold: 0 },
|
||||
{ name: "Omniscient", file: "omniscient", threshold: 10000 },
|
||||
{ name: "Transcendant", file: "transcendant", threshold: 5000 },
|
||||
{ name: "Mythique", file: "mythique", threshold: 2500 },
|
||||
{ name: "Légende", file: "légende", threshold: 1000 },
|
||||
{ name: "Maître", file: "maître", threshold: 500 },
|
||||
{ name: "Expert", file: "expert", threshold: 150 },
|
||||
{ name: "Adepte", file: "adepte", threshold: 50 },
|
||||
{ name: "Initié", file: "initié", threshold: 20 },
|
||||
{ name: "Apprenti", file: "apprenti", threshold: 5 },
|
||||
{ name: "Novice", file: "novice", threshold: 0 },
|
||||
];
|
||||
|
||||
export function getBadge(wins: number): Badge {
|
||||
|
||||
@@ -61,7 +61,8 @@ export function useGameEffects({
|
||||
multi.restore(saved.multiRoomCode, saved.multiPlayerId).then((ok) => {
|
||||
// si une nouvelle room a été rejointe pendant le restore, on laisse
|
||||
const current = loadSession();
|
||||
if (current?.multiRoomCode && current.multiRoomCode !== savedCode) return;
|
||||
if (current?.multiRoomCode && current.multiRoomCode !== savedCode)
|
||||
return;
|
||||
if (ok) setScreen("lobby");
|
||||
else {
|
||||
clearSession();
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ export function useMultiGame() {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ action: "heartbeat", playerId: ssePidRef.current }),
|
||||
}).catch(() => {});
|
||||
}, 20_000);
|
||||
}, 15_000);
|
||||
return () => clearInterval(id);
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user