diff --git a/lib/DefaultEvictor.js b/lib/DefaultEvictor.js index 6992aee1..1f9f3d47 100644 --- a/lib/DefaultEvictor.js +++ b/lib/DefaultEvictor.js @@ -1,31 +1,33 @@ "use strict"; class DefaultEvictor { - evict(config, pooledResource, availableObjectsCount) { - const idleTime = Date.now() - pooledResource.lastIdleTime; + evict(config, pooledResource, availableObjectsCount) { + const idleTime = Date.now() - pooledResource.lastIdleTime; - if (!idleTime) { - console.log('ERROR - idleTime is junk, evictig!', JSON.stringify({ - idleTime, - pooledResource, - })); - return true; - } + if (!idleTime) { + console.log( + 'ERROR - idleTime is junk, evictig!', + JSON.stringify({ + idleTime, + pooledResource, + })); + return true; + } - if ( - config.softIdleTimeoutMillis > 0 && - config.softIdleTimeoutMillis < idleTime && - config.min < availableObjectsCount - ) { - return true; - } + if ( + config.softIdleTimeoutMillis > 0 && + config.softIdleTimeoutMillis < idleTime && + config.min < availableObjectsCount + ) { + return true; + } - if (config.idleTimeoutMillis < idleTime) { - return true; - } + if (config.idleTimeoutMillis < idleTime) { + return true; + } - return false; - } + return false; + } } module.exports = DefaultEvictor;