Open muyinliu opened 10 years ago
Hi again, Thanks for contributing this feature!
But before it can be merged into master we need to do the following:
pool.lisp
README.md
), and also update the other sections where necessarytest.lisp
. IMHO, connection pools are not an easy feature to maintain, as there are numerous corner cases, like handling broken connections for various reasons (incl. timeouts - an optional keep-alive feature may be added). Without tests for all or at least most of such cases from the start, I'm affraid most of the users will get poor experience from such featureYou are right! A lot of work to do. I will do the first two jobs you mention. But I don't know how to write the test case for this... I need your help.
I will spend some time to take a look at Jedis(an Java implement of redis-cli). As I know, Jedis has perfect feature about connection pools.
You can take a look at the tests already present. First, I'd start with simple tests, like: take a connection from the pool, ensure that the number of connections decreased, ensure that you can ping the server, return the connection, ensure that it increased. Then I'd try to play with closing the connection from the code or by shutting down the server and seeing its effects, adding appropriate error-handling code, and finally adding tests to ensure that the code works.
Well, actually, my experience with Jedis is one of the reasons I think working supporting connection pools is hard :) (It was, actually, quite painful experience, when connections became unusable completely unpredictably and it was very hard to tackle that)
Thanks for your patience! I will try my best to complete this feature! Writing the test case will be a experience for myself.
You could check out https://github.com/quasi/pooler for pooling functionality
Add connection pools support.
Usage: