diff --git a/server-client/start-client.js b/server-client/start-client.js index 94d74e2f..51be9b93 100644 --- a/server-client/start-client.js +++ b/server-client/start-client.js @@ -33,6 +33,8 @@ export default async function run () { let retrieved = false; let offline = false; + var servicesInfo = ""; + await plugins.emit('onLoad', { ss }); async function startServer() { @@ -275,9 +277,11 @@ export default async function run () { var info = { ...msg.client, }; - if (Object.keys(info.gameInfo).length !== 0) { - fs.writeFileSync(path.join(ss.currentDir, 'store', 'client-modified', 'servicesInfo.json'), JSON.stringify(info)); + var newServicesInfo = JSON.stringify(info); + if (Object.keys(info.gameInfo).length !== 0 && servicesInfo !== newServicesInfo) { + fs.writeFileSync(path.join(ss.currentDir, 'store', 'client-modified', 'servicesInfo.json'), newServicesInfo); }; + servicesInfo = newServicesInfo; break; default: log.error(`Unknown command received: ${msg.cmd}`); diff --git a/server-game/src/roomManager.js b/server-game/src/roomManager.js index 2df4ed9f..ccce8f74 100644 --- a/server-game/src/roomManager.js +++ b/server-game/src/roomManager.js @@ -29,7 +29,7 @@ class newRoomManager { this.sendInfoToServices(); setInterval(() => { this.sendInfoToServices(); - }, 30e3); + }, ss.config.game.servicesInfoCollectInterval * 1e3); }; getUnusedID() { diff --git a/server-services/start-services.js b/server-services/start-services.js index 1703ca65..11b2b299 100644 --- a/server-services/start-services.js +++ b/server-services/start-services.js @@ -237,7 +237,7 @@ export default async function run () { } else { sendServicesInfo(); }; - }, 10e3); + }, ss.config.distributed_all.servicesInfoSendInterval * 1e3); } else if (ss.config.distributed_all.closed !== true) { switch (msg.cmd) { // Game server commands diff --git a/src/defaultconfig/distributed_all.yaml b/src/defaultconfig/distributed_all.yaml index e942660d..6630baa1 100644 --- a/src/defaultconfig/distributed_all.yaml +++ b/src/defaultconfig/distributed_all.yaml @@ -1,3 +1,9 @@ #this is what the other servers will ping this server for -closed: false # shuts down services/game and displays a closed message on the webpage. \ No newline at end of file +closed: false # shuts down services/game and displays a closed message on the webpage. + +# interval in seconds in which game/client servers report stats to the services server +servicesInfoCollectInterval: 15 + +# interval in seconds in which the services server sends specific stats back to game/client servers +servicesInfoSendInterval: 10 \ No newline at end of file