merge graph timestamps into single array, use seconds

This commit is contained in:
Nick Krecklow
2020-05-11 04:12:46 -05:00
parent ef0c41ee1d
commit 84004f22be
9 changed files with 64 additions and 100 deletions

View File

@ -85,6 +85,14 @@ class PingController {
pingAll = () => {
const timestamp = this._app.timeTracker.newTimestamp()
// Flag each group as history graph additions each minute
// This is sent to the frontend for graph updates
const updateHistoryGraph = config.logToDatabase && (!this._lastHistoryGraphUpdate || timestamp - this._lastHistoryGraphUpdate >= 60 * 1000)
if (updateHistoryGraph) {
this._lastHistoryGraphUpdate = timestamp
}
this.startPingTasks(results => {
const updates = []
@ -102,7 +110,7 @@ class PingController {
// 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
const update = serverRegistration.handlePing(timestamp, result.resp, result.err, result.version)
const update = serverRegistration.handlePing(timestamp, result.resp, result.err, result.version, updateHistoryGraph)
updates[serverRegistration.serverId] = update
}
@ -110,7 +118,8 @@ class PingController {
// Send object since updates uses serverIds as keys
// Send a single timestamp entry since it is shared
this._app.server.broadcast(MessageOf('updateServers', {
timestamp,
timestamp: Math.floor(timestamp / 1000),
updateHistoryGraph,
updates
}))
})