Skip to content

Commit 4f4c27a

Browse files
author
mjgp2
committed
Using hostaddr will cache the DNS lookup
"If host is specified without hostaddr, a host name lookup occurs." https://www.postgresql.org/docs/8.1/libpq.html#LIBPQ-CONNECT
1 parent f5e87ac commit 4f4c27a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/pg/lib/connection-parameters.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ class ConnectionParameters {
155155
if (this.client_encoding) {
156156
params.push('client_encoding=' + quoteParamValue(this.client_encoding))
157157
}
158-
dns.lookup(this.host, function (err, address) {
159-
if (err) return cb(err, null)
160-
params.push('hostaddr=' + quoteParamValue(address))
161-
return cb(null, params.join(' '))
162-
})
158+
return cb(null, params.join(' '))
163159
}
164160
}
165161

0 commit comments

Comments
 (0)