From ca84e8ebf79d7272a6cfc535c88f154cb00136ec Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sat, 5 Mar 2011 21:30:37 -0500 Subject: cap connection pool size --- client/connpool.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/connpool.h b/client/connpool.h index 00570c52d5b..520461a0bd7 100644 --- a/client/connpool.h +++ b/client/connpool.h @@ -87,8 +87,17 @@ namespace mongo { delete c; return; } - scoped_lock L(_mutex); - _pools[host].pool.push(c); + + { + scoped_lock L(_mutex); + if ( _pools[host].pool.size() < 50 ) { + _pools[host].pool.push(c); + return; + } + } + + // if we get here it means we didn't add for some reason + delete c; } void addHook( DBConnectionHook * hook ); void appendInfo( BSONObjBuilder& b ); -- cgit v1.2.1