share a single timestamp array between all graphData objects
This commit is contained in:
10
lib/app.js
10
lib/app.js
@ -41,18 +41,14 @@ class App {
|
||||
if (config.logToDatabase) {
|
||||
client.on('message', (message) => {
|
||||
if (message === 'requestHistoryGraph') {
|
||||
// FIXME: update schema, remove timestamp
|
||||
// Since all history graph updates share timestamps, pull the timestamps from a single ServerRegistration
|
||||
const timestamps = this.serverRegistrations[0].graphData.map(point => Math.floor(point[0] / 1000))
|
||||
|
||||
// Send historical graphData built from all serverRegistrations
|
||||
const graphData = this.serverRegistrations.map(serverRegistration => serverRegistration.graphData.map(point => point[1]))
|
||||
const graphData = this.serverRegistrations.map(serverRegistration => serverRegistration.graphData)
|
||||
|
||||
// Send graphData in object wrapper to avoid needing to explicity filter
|
||||
// any header data being appended by #MessageOf since the graph data is fed
|
||||
// directly into the graphing system
|
||||
client.send(MessageOf('historyGraph', {
|
||||
timestamps,
|
||||
timestamps: this.timeTracker.getHistoricalPointsSeconds(),
|
||||
graphData
|
||||
}))
|
||||
}
|
||||
@ -78,7 +74,7 @@ class App {
|
||||
}
|
||||
})(),
|
||||
mojangServices: this.mojangUpdater.getLastUpdate(),
|
||||
timestampPoints: this.timeTracker.getPointsSeconds(),
|
||||
timestampPoints: this.timeTracker.getServerPointsSeconds(),
|
||||
servers: this.serverRegistrations.map(serverRegistration => serverRegistration.getPingHistory())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user