Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ConnectionPool::TimedStack is now lazy #52
Now TimedStack only creates connections when the internal queue is empty
This required some changes to the TimedStack tests because I wrote poor
This required some changes to the ConnectionPool tests to use up
Changing the semantics of the connection pool from eager to lazy is a very big semantic change and something worthy of a 2.0 version bump. I suspect many people depend on the behavior implicitly. I've not been a fan of lazy stuff when it comes to multi-threaded code as there's lots of room for race conditions. Perhaps I'm being too much of a crotchety old man.
Future steps in this work are (in no particular order):
The ultimate goal is to use connection_pool in net-http-persistent. connection_pool would handle handing out connections for whatever host the user needed to talk to while reaping connections that weren't recently used.
This could work with both a small number of connections (for connecting to an API) or a large number of connections (for web spider work) since connection_pool has accounting built-in.
When I'm done I think my changes will be 2.0-worthy. How would you best like to review my changes? The changes I've mentioned above will need to build atop each other which doesn't lend itself to pull requests particularly well.