Permalink
Browse files

Fix Pool maxIdleTimes of less than 600 seconds.

  • Loading branch information...
1 parent 1abbaff commit b601fe7d5f04f3bc72fbee6a2cd0036a574f70e8 @FooBarWidget FooBarWidget committed Apr 7, 2013
Showing with 9 additions and 10 deletions.
  1. +5 −1 ext/common/ApplicationPool2/Pool.h
  2. +4 −9 test/cxx/ApplicationPool2/PoolTest.cpp
@@ -620,7 +620,11 @@ class Pool: public enable_shared_from_this<Pool> {
// Schedule next garbage collection run.
unsigned long long sleepTime;
if (nextGcRunTime == 0 || nextGcRunTime <= now) {
- sleepTime = std::max<unsigned long long>(maxIdleTime, 10 * 60 * 1000000);
+ if (maxIdleTime == 0) {
+ sleepTime = 10 * 60 * 1000000;
+ } else {
+ sleepTime = maxIdleTime;
+ }
} else {
sleepTime = nextGcRunTime - now;
}
@@ -1116,18 +1116,13 @@ namespace tut {
TEST_METHOD(64) {
// Test process idle cleaning.
Options options = createOptions();
- retainSessions = true;
pool->setMaxIdleTime(50000);
- pool->asyncGet(options, callback);
- pool->asyncGet(options, callback);
- EVENTUALLY(2,
- result = number == 2;
- );
+ SessionPtr session1 = pool->get(options, &ticket);
+ SessionPtr session2 = pool->get(options, &ticket);
ensure_equals(pool->getProcessCount(), 2u);
-
- currentSession.reset();
- sessions.pop_back();
+ session2.reset();
+
// One of the processes still has a session open and should
// not be idle cleaned.
EVENTUALLY(2,

0 comments on commit b601fe7

Please sign in to comment.