Clean up abandoned matches and fix analytics validation

This commit is contained in:
2026-10-19 15:23:16 +09:00
parent 65c3941e29
commit 6f44ec0d15
14 changed files with 232 additions and 10 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ export function registerPresence(io: Server, sessions: GameSessionStore) {
}
namespace.use((socket, next) => {
const { gameSessionId, token } = socket.handshake.auth;
void sessions.get({ gameSessionId, token }).then(session => {
void sessions.touchPresence({ gameSessionId, token }).then(session => {
socket.data.playerId = session.playerId ?? session.gameSessionId;
next();
}, error => next(new Error(error instanceof ApiError && error.statusCode === 401 ? 'INVALID_SESSION' : 'PRESENCE_UNAVAILABLE')));
@@ -25,7 +25,7 @@ export function registerPresence(io: Server, sessions: GameSessionStore) {
if (checking) return;
checking = true;
const { gameSessionId, token } = socket.handshake.auth;
void sessions.get({ gameSessionId, token }).catch(error => {
void sessions.touchPresence({ gameSessionId, token }).catch(error => {
if (error instanceof ApiError && error.statusCode === 401) socket.disconnect(true);
else socket.conn.close(); // Transport closure permits Socket.IO to reconnect after a transient outage.
}).finally(() => { checking = false; });