update default connection timeout

This commit is contained in:
Lee 2023-12-30 23:54:53 +00:00
parent 2992ad84da
commit 0fbea0cb4e
3 changed files with 2 additions and 5 deletions

@ -5,7 +5,7 @@
}, },
"rates": { "rates": {
"pingAll": 15000, "pingAll": 15000,
"connectTimeout": 2500 "connectTimeout": 10000
}, },
"oldPingsCleanup": { "oldPingsCleanup": {
"enabled": false, "enabled": false,

@ -239,7 +239,6 @@ class Database {
// Record not found // Record not found
if (data[0] === undefined) { if (data[0] === undefined) {
// eslint-disable-next-line node/no-callback-literal
callback(false); callback(false);
return; return;
} }
@ -248,7 +247,6 @@ class Database {
const timestamp = data[0].timestamp; const timestamp = data[0].timestamp;
// Allow null player counts and timestamps, the frontend will safely handle them // Allow null player counts and timestamps, the frontend will safely handle them
// eslint-disable-next-line node/no-callback-literal
callback(true, playerCount, timestamp); callback(true, playerCount, timestamp);
} }
); );
@ -272,10 +270,8 @@ class Database {
// Allow null timestamps, the frontend will safely handle them // Allow null timestamps, the frontend will safely handle them
// This allows insertion of free standing records without a known timestamp // This allows insertion of free standing records without a known timestamp
if (playerCount !== null) { if (playerCount !== null) {
// eslint-disable-next-line node/no-callback-literal
callback(true, playerCount, timestamp); callback(true, playerCount, timestamp);
} else { } else {
// eslint-disable-next-line node/no-callback-literal
callback(false); callback(false);
} }
} }

@ -106,6 +106,7 @@ class PingController {
schedule() { schedule() {
setInterval(this.pingAll, config.rates.pingAll); setInterval(this.pingAll, config.rates.pingAll);
// todo: make this a cron job?
this.pingAll(); this.pingAll();
} }