Sometimes we're spawning to reach min not spare
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 7 Nov 2016 18:32:29 +0000 (13:32 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 7 Nov 2016 18:34:16 +0000 (13:34 -0500)
src/main/connection.c

index 81c8963..ccc74e2 100644 (file)
@@ -647,6 +647,8 @@ static int fr_connection_pool_check(fr_connection_pool_t *pool)
                spawn = pool->min - (pool->num + pool->pending);
                extra = 0;
 
+               ROPTIONAL(RINFO, INFO, "Need %i more connections to reach min connections (%i)", spawn, pool->min);
+
        /*
         *      If we're about to create more than "max",
         *      don't create more.
@@ -678,6 +680,8 @@ static int fr_connection_pool_check(fr_connection_pool_t *pool)
                        spawn = pool->max - (pool->num + pool->pending);
                }
 
+               ROPTIONAL(RINFO, INFO, "Need %i more connections to reach %i spares", spawn, pool->spare);
+
        /*
         *      min < num < max
         *
@@ -712,8 +716,6 @@ static int fr_connection_pool_check(fr_connection_pool_t *pool)
         *      a connection. Avoids spurious log messages.
         */
        if (spawn) {
-               INFO("%s: Need %i more connections to reach %i spares",
-                    pool->log_prefix, spawn, pool->spare);
                pthread_mutex_unlock(&pool->mutex);
                fr_connection_spawn(pool, now, false); /* ignore return code */
                pthread_mutex_lock(&pool->mutex);
@@ -838,7 +840,7 @@ static void *fr_connection_get_internal(fr_connection_pool_t *pool, bool spawn)
                }
 
                pthread_mutex_unlock(&pool->mutex);
-               
+
                if (!RATE_LIMIT_ENABLED || complain) {
                        ERROR("%s: No connections available and at max connection limit", pool->log_prefix);
                }