Skip to content

Commit b58dfd2

Browse files
author
James William Pye
committed
Build out the connection before connecting.
1 parent f170ec5 commit b58dfd2

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

postgresql/cluster.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,14 @@ def ready_for_connections(self):
539539
return False
540540
e = None
541541
host, port = self.address()
542+
connection = self.driver.fit(
543+
user = ' -*- ping -*- ',
544+
host = host, port = port,
545+
database = 'template1',
546+
sslmode = 'disable',
547+
)()
542548
try:
543-
self.driver.connect(
544-
user = ' -*- ping -*- ',
545-
host = host or 'localhost',
546-
port = port or 5432,
547-
database = 'template1',
548-
sslmode = 'disable',
549-
).close()
549+
connection.connect()
550550
except pg_exc.ClientCannotConnectError as err:
551551
for attempt in err.database.failures:
552552
x = attempt.error

0 commit comments

Comments
 (0)