Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
Removed redundant timer.
  • Loading branch information
lnedry authored Nov 4, 2024
1 parent 38de679 commit 3894c78
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,6 @@ exports.get_a_records = async function (host) {
throw e
}

// Set-up timer
let timed_out = false
const timer = setTimeout(
() => {
timed_out = true
const err = new Error(`timeout resolving: ${host}`)
err.code = dns.TIMEOUT
this.logerror(err)
throw err
},
(this.cfg.main.dns_timeout || 28) * 1000,
)

// fully qualify, to ignore any search options in /etc/resolv.conf
if (!/\.$/.test(host)) host = `${host}.`

Expand All @@ -550,8 +537,6 @@ exports.get_a_records = async function (host) {
}

// results is now equals to: {queryA: 1, queryAAAA: 2}
if (timed_out) return
if (timer) clearTimeout(timer)
if (!ips.length && err) throw err
// this.logdebug(this, host + ' => ' + ips);
// return the DNS results
Expand Down

0 comments on commit 3894c78

Please sign in to comment.