remove graph smoothing behavior, add null playerCount support
This commit is contained in:
@ -92,8 +92,9 @@ class PingController {
|
||||
const result = results[serverRegistration.serverId]
|
||||
|
||||
// Log to database if enabled
|
||||
// Use null to represent a failed ping
|
||||
if (config.logToDatabase) {
|
||||
const playerCount = result.resp ? result.resp.players.online : 0
|
||||
const playerCount = result.resp ? result.resp.players.online : null
|
||||
|
||||
this._app.database.insertPing(serverRegistration.data.ip, timestamp, playerCount)
|
||||
}
|
||||
@ -130,6 +131,12 @@ class PingController {
|
||||
const version = serverRegistration.getNextProtocolVersion()
|
||||
|
||||
ping(serverRegistration, config.rates.connectTimeout, (err, resp) => {
|
||||
if (Math.random() < 0.1) {
|
||||
err = {
|
||||
message: 'random fail'
|
||||
}
|
||||
resp = undefined
|
||||
}
|
||||
if (err) {
|
||||
logger.log('error', 'Failed to ping %s: %s', serverRegistration.data.ip, err.message)
|
||||
}
|
||||
|
Reference in New Issue
Block a user