merge updateHistoryGraph behavior into update flag
This commit is contained in:
13
lib/ping.js
13
lib/ping.js
@ -109,6 +109,8 @@ class PingController {
|
||||
|
||||
serverRegistration.addPing(timestamp, resp)
|
||||
|
||||
let updateHistoryGraph = false
|
||||
|
||||
if (config.logToDatabase) {
|
||||
const playerCount = resp ? resp.players.online : 0
|
||||
|
||||
@ -116,15 +118,14 @@ class PingController {
|
||||
this._app.database.insertPing(serverRegistration.data.ip, timestamp, playerCount)
|
||||
|
||||
if (serverRegistration.addGraphPoint(resp !== undefined, playerCount, timestamp)) {
|
||||
this._app.server.broadcast('updateHistoryGraph', {
|
||||
serverId: serverRegistration.serverId,
|
||||
playerCount: playerCount,
|
||||
timestamp: timestamp
|
||||
})
|
||||
updateHistoryGraph = true
|
||||
}
|
||||
}
|
||||
|
||||
this._app.server.broadcast('update', serverRegistration.getUpdate(timestamp, resp, err, version))
|
||||
// Generate a combined update payload
|
||||
// This includes any modified fields and flags used by the frontend
|
||||
// This will not be cached and can contain live metadata
|
||||
this._app.server.broadcast('update', serverRegistration.getUpdate(timestamp, resp, err, version, updateHistoryGraph))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user