diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-03-05 21:30:37 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-03-05 21:30:37 -0500 |
commit | ca84e8ebf79d7272a6cfc535c88f154cb00136ec (patch) | |
tree | 016a40999bf3d23deb3a2fc07fdcff67ec5841d3 | |
parent | 3047651c7f342b4a3ad994a3301918446aa9edfd (diff) | |
download | mongo-v1.6.tar.gz |
cap connection pool sizev1.6
-rw-r--r-- | client/connpool.h | 13 |
1 files 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 ); |