fix(server): tokens of deleted accounts are refused; a failing message or fight can no longer crash the server
After a database reset an old (still signed) token made economy.load insert a save for a missing user; the FOREIGN KEY error escaped the WebSocket handler and took the process down in a restart loop.
This commit is contained in:
@@ -14,7 +14,10 @@ function createRunner(opt = {}) {
|
||||
let n = 0;
|
||||
while (now >= next && n < 10) {
|
||||
const t0 = performance.now();
|
||||
for (const room of rooms.values()) room.tick();
|
||||
for (const room of rooms.values()) {
|
||||
// one broken fight must never stop the others (or the server): end it as a draw and log it
|
||||
try { room.tick(); } catch (e) { console.error('[match] room', room.id, 'crashed', e); try { room.finish({ winner: -1, reason: 'time' }); } catch (e2) { rooms.delete(room.id); } }
|
||||
}
|
||||
const ms = performance.now() - t0;
|
||||
if (ms > 8 && Date.now() - slowLogged > 10000) { slowLogged = Date.now(); console.warn(`[match] slow tick ${ms.toFixed(1)} ms for ${rooms.size} rooms`); }
|
||||
next += STEP; n++;
|
||||
|
||||
Reference in New Issue
Block a user