add ability to skip unfurlSrv calls to avoid ping cost

This commit is contained in:
Nick Krecklow 2020-05-07 23:46:59 -05:00
parent ac06ae884e
commit a3c88dc0c5
No known key found for this signature in database
GPG Key ID: 5F149FDE156FFA94
3 changed files with 12 additions and 0 deletions

@ -9,6 +9,9 @@
"pingAll": 3000,
"connectTimeout": 2500
},
"performance": {
"skipUnfurlSrv": false
},
"logToDatabase": false,
"graphDuration": 86400000
}

@ -54,6 +54,11 @@ function ping (host, port, type, timeout, callback, version) {
}
function unfurlSrv (hostname, port, callback) {
if (config.performance && config.performance.skipUnfurlSrv) {
callback(hostname, port)
return
}
dns.resolveSrv('_minecraft._tcp.' + hostname, (_, records) => {
if (!records || records.length < 1) {
callback(hostname, port)

@ -25,6 +25,10 @@ servers.forEach((server, serverId) => {
app.serverRegistrations.push(new ServerRegistration(serverId, server))
})
if (config.performance && config.performance.skipUnfurlSrv) {
logger.log('warn', '"performance.skipUnfurlSrv" is enabled. Any configured hosts using SRV records may not properly resolve.')
}
if (!config.logToDatabase) {
logger.log('warn', 'Database logging is not enabled. You can enable it by setting "logToDatabase" to true in config.json. This requires sqlite3 to be installed.')