diff --git a/lib/servers.js b/lib/servers.js index d0ffd90..f5c2f87 100644 --- a/lib/servers.js +++ b/lib/servers.js @@ -1,6 +1,8 @@ const config = require('../config') const minecraftVersions = require('../minecraft_versions') +const SERVER_GRAPH_DATA_MAX_LENGTH = 72 + class ServerRegistration { serverId lastFavicon @@ -105,7 +107,7 @@ class ServerRegistration { this._pingHistory.push(ping) // Trim pingHistory to avoid memory leaks - if (this._pingHistory.length > 72) { + if (this._pingHistory.length > SERVER_GRAPH_DATA_MAX_LENGTH) { this._pingHistory.shift() } } diff --git a/lib/time.js b/lib/time.js index c820ae6..a7ac7ec 100644 --- a/lib/time.js +++ b/lib/time.js @@ -1,3 +1,5 @@ +const SERVER_GRAPH_DATA_MAX_LENGTH = require('./servers').SERVER_GRAPH_DATA_MAX_LENGTH + class TimeTracker { constructor () { this._points = [] @@ -8,7 +10,7 @@ class TimeTracker { this._points.push(timestamp) - if (this._points.length > 72) { + if (this._points.length > SERVER_GRAPH_DATA_MAX_LENGTH) { this._points.shift() }