Added a single idleTimeout

This commit is contained in:
aqw42
2025-05-29 19:09:33 +02:00
parent 45036defcb
commit 9e427110bb
+5 -6
View File
@@ -35,8 +35,7 @@ export class GameServer {
private maxGameDuration = 3 * 60 * 60 * 1000; // 3 hours
private disconnectionTimeout = 1 * 60 * 1000; // 1 minute
private inactivityTimeout = 3 * 60 * 1000; // 3 minute
private idleTimeout = 1 * 60 * 1000; // 1 minute
private turns: Turn[] = [];
private intents: Intent[] = [];
@@ -552,14 +551,14 @@ export class GameServer {
for (const [clientID, client] of this.allClients) {
if (
client.isIdle === false &&
(now - client.lastPing > this.disconnectionTimeout ||
now - client.lastAction > this.inactivityTimeout)
now - client.lastPing > this.idleTimeout &&
now - client.lastAction > this.idleTimeout
) {
this.markClientIdle(client, true);
} else if (
client.isIdle &&
now - client.lastPing < this.disconnectionTimeout &&
now - client.lastAction < this.inactivityTimeout
now - client.lastPing < this.idleTimeout &&
now - client.lastAction < this.idleTimeout
) {
this.markClientIdle(client, false);
}