use a single, shared timestamps array between all pings

This commit is contained in:
Nick Krecklow
2020-05-08 01:22:07 -05:00
parent 3ddb2c9a08
commit c2494af82d
7 changed files with 55 additions and 30 deletions

View File

@ -16,7 +16,7 @@ class ServerRegistration {
handlePing (timestamp, resp, err, version) {
// Store into in-memory ping data
this.addPing(timestamp, resp)
this.addPing(resp)
// Only notify the frontend to append to the historical graph
// if both the graphing behavior is enabled and the backend agrees
@ -89,10 +89,8 @@ class ServerRegistration {
return update
}
addPing (timestamp, resp) {
const ping = {
timestamp: timestamp
}
addPing (resp) {
const ping = {}
if (resp) {
// Append a result object
@ -127,7 +125,6 @@ class ServerRegistration {
const payload = {
serverId: this.serverId,
timestamp: lastPing.timestamp,
versions: this.versions,
recordData: this.recordData,
favicon: this.lastFavicon
@ -157,7 +154,6 @@ class ServerRegistration {
return [{
serverId: this.serverId,
timestamp: new Date().getTime(),
error: {
message: 'Waiting...',
placeholder: true