Skip to content

Commit 149ad59

Browse files
committed
Postgres connection: limit user/pw queries to 5 (avoids blocking server instances if a db does not exist anymore)
1 parent b3f00ec commit 149ad59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/providers/postgres/qgspostgresconn.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,10 @@ QgsPostgresConn::QgsPostgresConn( QString conninfo, bool readOnly, bool shared )
183183

184184
QgsCredentials::instance()->lock();
185185

186-
while ( PQstatus() != CONNECTION_OK )
186+
int i = 0;
187+
while ( PQstatus() != CONNECTION_OK && i < 5 )
187188
{
189+
++i;
188190
bool ok = QgsCredentials::instance()->get( conninfo, username, password, PQerrorMessage() );
189191
if ( !ok )
190192
break;

0 commit comments

Comments
 (0)