make getMaxGraphDataLength/getMaxServerGraphDataLength methods static

This commit is contained in:
Nick Krecklow
2020-05-08 02:56:39 -05:00
parent 3491c73b89
commit 024e605a41
5 changed files with 19 additions and 16 deletions

View File

@ -1,3 +1,5 @@
const TimeTracker = require('./time')
const config = require('../config')
const minecraftVersions = require('../minecraft_versions')
@ -8,8 +10,7 @@ class ServerRegistration {
recordData
graphData = []
constructor (app, serverId, data) {
this._app = app
constructor (serverId, data) {
this.serverId = serverId
this.data = data
this._pingHistory = []
@ -22,7 +23,7 @@ class ServerRegistration {
this._pingHistory.push(playerCount)
// Trim pingHistory to avoid memory leaks
if (this._pingHistory.length > this._app.pingController.getMaxServerGraphDataLength()) {
if (this._pingHistory.length > TimeTracker.getMaxServerGraphDataLength()) {
this._pingHistory.shift()
}
@ -178,7 +179,7 @@ class ServerRegistration {
this._lastGraphDataPush = timestamp
// Trim old graphPoints according to #getMaxGraphDataLength
if (this.graphData.length > this._app.pingController.getMaxGraphDataLength()) {
if (this.graphData.length > TimeTracker.getMaxGraphDataLength()) {
this.graphData.shift()
}