Closed gnawux closed 6 years ago
@szank @domodwyer I updated #87 based on your review and added tests here.
@szank Thanks for your comments, updated.
looks the travis failure is not related with this patch
👍 nice work! LGTM.
Hi @gnawux
This looks great, I'll get the build to pass with a bit of retry fun and then we'll get this merged.
Thanks so much for taking the time to help!
Dom
It's my pleasure, and as I mentioned in the commit message, the original investigation credits to @JodeZer, I just did some tests and improvement.
This is an updated version of #87, changes:
Below is the original introduction
we found the mgo will allocate the pool size during burst traffic but won't close the sockets any more until restart the client or server.
And the mongo document defines two related query options
By implementing these two options, it could shrink the pool to minPoolSize after the sockets introduced by burst traffic timeout.
The idea comes from https://github.com/JodeZer/mgo , he investigated this issue and provide the initial commits.
I found there are still some issue in sockets maintenance, and had a PR against his repo JodeZer/mgo#1 .
This commit include JodeZer's commits and my fix, and I simplified the data structure. What's in this commit could be described as this figure: