diff --git a/lib/DefaultEvictor.js b/lib/DefaultEvictor.js index 658d345a..83de63ca 100644 --- a/lib/DefaultEvictor.js +++ b/lib/DefaultEvictor.js @@ -1,19 +1,30 @@ "use strict"; +const util = require('util'); class DefaultEvictor { evict(config, pooledResource, availableObjectsCount) { const idleTime = Date.now() - pooledResource.lastIdleTime; + if (!idleTime) { + console.log( + "ERROR - idleTime is junk, evictig", + util.inspect({ + idleTime, + pooledResource + })); + return true; + } + if ( - config.softIdleTimeoutMillis > 0 && - config.softIdleTimeoutMillis < idleTime && - config.min < availableObjectsCount + config.softIdleTimeoutMillis > 0 && + config.softIdleTimeoutMillis < idleTime && + config.min < availableObjectsCount ) { - return true; + return true; } if (config.idleTimeoutMillis < idleTime) { - return true; + return true; } return false;