Skip to content

Commit

Permalink
Cap spawn at max
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed May 7, 2014
1 parent c7f4257 commit d13ecb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/connection.c
Expand Up @@ -828,10 +828,15 @@ static int fr_connection_pool_check(fr_connection_pool_t *pool)
} else if (idle <= pool->spare) {
/*
* Not enough spare connections. Spawn a few.
* But cap the pool size at "max"
*/
spawn = pool->spare - idle;
extra = 0;

if ((pool->num + spawn) > pool->max) {
spawn = pool->max - pool->num;
}

} else if ((pool->min + extra) >= pool->num) {
/*
* If closing the extra connections would take us
Expand Down

0 comments on commit d13ecb8

Please sign in to comment.