Skip to content

Commit 3bcf1a1

Browse files
Control Connection bug fix (#7)
1 parent 9120b89 commit 3bcf1a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/pg/lib/client.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,17 @@ class Client extends EventEmitter {
378378
}
379379

380380
async iterateHostList(client) {
381+
logger.silly([...Client.hostServerInfo])
382+
logger.silly([...Client.failedHosts])
381383
let upHostsList = Client.hostServerInfo.keys()
382384
let upHost = upHostsList.next()
383385
let hostIsUp = false
384-
while (upHost.value !== undefined && !hostIsUp && !Client.failedHosts.has(upHost.value)) {
386+
while (upHost.value !== undefined && !hostIsUp) {
387+
if (Client.failedHosts.has(upHost.value)) {
388+
logger.silly(upHost.value + " is present in failed host list, trying next host")
389+
upHost = upHostsList.next()
390+
continue
391+
}
385392
client.host = upHost.value
386393
client.connectionParameters.host = client.host
387394
logger.debug("Trying to create control connection to " + client.host)

0 commit comments

Comments
 (0)