reduce naming inversion to simplify logic reading
This commit is contained in:
parent
70cfa641e6
commit
05487d15ca
@ -52,11 +52,12 @@ class DNSResolver {
|
|||||||
// Test if the error indicates a miss, or if the records returned are empty
|
// Test if the error indicates a miss, or if the records returned are empty
|
||||||
if ((err && (err.code === 'ENOTFOUND' || err.code === 'ENODATA')) || !records || records.length === 0) {
|
if ((err && (err.code === 'ENOTFOUND' || err.code === 'ENODATA')) || !records || records.length === 0) {
|
||||||
// Compare config.skipSrvTimeout directly since SKIP_SRV_TIMEOUT has an or'd value
|
// Compare config.skipSrvTimeout directly since SKIP_SRV_TIMEOUT has an or'd value
|
||||||
const isSkipSrvTimeoutActive = typeof config.skipSrvTimeout !== 'number' || config.skipSrvTimeout > 0
|
// isValidSkipSrvTimeout == whether the config has a valid skipSrvTimeout value set
|
||||||
|
const isValidSkipSrvTimeout = typeof config.skipSrvTimeout === 'number' && config.skipSrvTimeout > 0
|
||||||
|
|
||||||
// Only activate _skipSrv if the skipSrvTimeout value is either NaN or > 0
|
// Only activate _skipSrv if the skipSrvTimeout value is either NaN or > 0
|
||||||
// 0 represents a disabled flag
|
// 0 represents a disabled flag
|
||||||
if (!this._isSkipSrv() && !isSkipSrvTimeoutActive) {
|
if (!this._isSkipSrv() && isValidSkipSrvTimeout) {
|
||||||
this._skipSrv()
|
this._skipSrv()
|
||||||
|
|
||||||
logger.log('warn', 'No SRV records were resolved for %s. Minetrack will skip attempting to resolve %s SRV records for %d minutes.', this._ip, this._ip, SKIP_SRV_TIMEOUT / (60 * 1000))
|
logger.log('warn', 'No SRV records were resolved for %s. Minetrack will skip attempting to resolve %s SRV records for %d minutes.', this._ip, this._ip, SKIP_SRV_TIMEOUT / (60 * 1000))
|
||||||
|
Loading…
Reference in New Issue
Block a user