coopernurse/node-pool — pull request #68 by payamsabz (2014-02-28 00:15:13+00:00)
Title: Improving Cleanup of Pool Objects

By changing the availableObjects list from a queue into a stack the timeout on more objects will be hit sooner and unnecessary resources will be cleaned up faster.
For example if the program needs one resource object per second from the pool and the idle timeout is 30 seconds, with a queue data-structure (current code) about 30 objects will stay in the pool at any given time even though we really need one object. By changing the queue to a stack the same object that is returned to pool the last is reused next causing better utilization of the resources and only having around 1 object in the pool.