unify 72 magic number behind named constant
This commit is contained in:
parent
7993ac0077
commit
aee7b565b2
@ -1,6 +1,8 @@
|
|||||||
const config = require('../config')
|
const config = require('../config')
|
||||||
const minecraftVersions = require('../minecraft_versions')
|
const minecraftVersions = require('../minecraft_versions')
|
||||||
|
|
||||||
|
const SERVER_GRAPH_DATA_MAX_LENGTH = 72
|
||||||
|
|
||||||
class ServerRegistration {
|
class ServerRegistration {
|
||||||
serverId
|
serverId
|
||||||
lastFavicon
|
lastFavicon
|
||||||
@ -105,7 +107,7 @@ class ServerRegistration {
|
|||||||
this._pingHistory.push(ping)
|
this._pingHistory.push(ping)
|
||||||
|
|
||||||
// Trim pingHistory to avoid memory leaks
|
// Trim pingHistory to avoid memory leaks
|
||||||
if (this._pingHistory.length > 72) {
|
if (this._pingHistory.length > SERVER_GRAPH_DATA_MAX_LENGTH) {
|
||||||
this._pingHistory.shift()
|
this._pingHistory.shift()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const SERVER_GRAPH_DATA_MAX_LENGTH = require('./servers').SERVER_GRAPH_DATA_MAX_LENGTH
|
||||||
|
|
||||||
class TimeTracker {
|
class TimeTracker {
|
||||||
constructor () {
|
constructor () {
|
||||||
this._points = []
|
this._points = []
|
||||||
@ -8,7 +10,7 @@ class TimeTracker {
|
|||||||
|
|
||||||
this._points.push(timestamp)
|
this._points.push(timestamp)
|
||||||
|
|
||||||
if (this._points.length > 72) {
|
if (this._points.length > SERVER_GRAPH_DATA_MAX_LENGTH) {
|
||||||
this._points.shift()
|
this._points.shift()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user