]> granicus.if.org Git - pgbouncer/commitdiff
Move fast-fail relaunch logic around.
authorMarko Kreen <markokr@gmail.com>
Wed, 14 Apr 2010 08:08:27 +0000 (08:08 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 14 Apr 2010 08:08:27 +0000 (08:08 +0000)
Do it together with fast-fail disconnect.  When kept separately
it can launch even if there are no new clients coming.
This causes problem with permanently dead dbs/users, as the
retry will not stop if all clients are gone.

src/janitor.c
src/objects.c

index b37d028e859ef24b0853a1219fc8efa34ada948c..21b6396c4c26b34ea9174995d916146f741d39dd 100644 (file)
@@ -429,13 +429,6 @@ static void check_pool_size(PgPool *pool)
                disconnect_server(server, true, "too many servers in the pool");
                many--;
        }
-
-       /*
-        * Because of fast-fail we may not have any waiting clients that would
-        * trigger server re-connect.  So do it explicitly.
-        */
-       if (cur == 0 && pool->last_connect_failed)
-               launch_new_connection(pool);
 }
 
 /* maintain servers in a pool */
index 40783552214d446d02cbc27349d18275ed11ced7..1605e7e6a56d6618bc4efc624473dcd7c567fc34 100644 (file)
@@ -524,6 +524,9 @@ bool find_server(PgSocket *client)
                if (!server && pool->last_connect_failed) {
                        int cnt = pool_server_count(pool) - statlist_count(&pool->new_server_list);
                        if (!cnt) {
+                               /* usual relaunch wont work, as there are no waiting clients */
+                               launch_new_connection(client->pool);
+
                                disconnect_client(client, true, "no working server connection");
                                return false;
                        }