make getMaxGraphDataLength/getMaxServerGraphDataLength methods static
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user