Skip to content

Commit

Permalink
Postgres connection: limit user/pw queries to 5 (avoids blocking serv…
Browse files Browse the repository at this point in the history
…er instances if a db does not exist anymore)
  • Loading branch information
mhugent committed Oct 8, 2014
1 parent b3f00ec commit 149ad59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/providers/postgres/qgspostgresconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ QgsPostgresConn::QgsPostgresConn( QString conninfo, bool readOnly, bool shared )

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

while ( PQstatus() != CONNECTION_OK )
int i = 0;
while ( PQstatus() != CONNECTION_OK && i < 5 )
{
++i;
bool ok = QgsCredentials::instance()->get( conninfo, username, password, PQerrorMessage() );
if ( !ok )
break;
Expand Down

0 comments on commit 149ad59

Please sign in to comment.