work on bulking updateServer payloads and single timestamps
This commit is contained in:
@ -14,12 +14,30 @@ class ServerRegistration {
|
||||
this._pingHistory = []
|
||||
}
|
||||
|
||||
getUpdate (timestamp, resp, err, version, updateHistoryGraph) {
|
||||
const update = {
|
||||
serverId: this.serverId,
|
||||
timestamp: timestamp
|
||||
handlePing (timestamp, resp, err, version) {
|
||||
// Store into in-memory ping data
|
||||
this.addPing(timestamp, resp)
|
||||
|
||||
// Only notify the frontend to append to the historical graph
|
||||
// if both the graphing behavior is enabled and the backend agrees
|
||||
// that the ping is eligible for addition
|
||||
let updateHistoryGraph = false
|
||||
|
||||
if (config.logToDatabase) {
|
||||
const playerCount = resp ? resp.players.online : 0
|
||||
|
||||
if (this.addGraphPoint(resp !== undefined, playerCount, timestamp)) {
|
||||
updateHistoryGraph = true
|
||||
}
|
||||
}
|
||||
|
||||
// Delegate out update payload generation
|
||||
return this.getUpdate(timestamp, resp, err, version, updateHistoryGraph)
|
||||
}
|
||||
|
||||
getUpdate (timestamp, resp, err, version, updateHistoryGraph) {
|
||||
const update = {}
|
||||
|
||||
if (resp) {
|
||||
if (resp.version && this.updateProtocolVersionCompat(resp.version, version.protocolId, version.protocolIndex)) {
|
||||
// Append an updated version listing
|
||||
|
Reference in New Issue
Block a user