-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared pool among clients and fixed pool resources release #51
Conversation
…o releases the resources used by the pool ( single, and multihost )
Codecov Report
@@ Coverage Diff @@
## master #51 +/- ##
==========================================
- Coverage 72.65% 72.59% -0.06%
==========================================
Files 12 12
Lines 1064 1080 +16
==========================================
+ Hits 773 784 +11
- Misses 232 236 +4
- Partials 59 60 +1
Continue to review full report at Codecov.
|
@ericfengchao can you review this one as well? Would like your input but was not able to mark you as reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but lets indeed wait for @ericfengchao to look and try before merging.
@itamarhaber and @ericfengchao can you double-check the changes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the change to Close will only report the last error I'm good with that (is returning an array of errors something that's done in golang anyway?)
Now that you've mentioned it @itamarhaber I believe the best way is to keep the function signature but to generate an error with all details of error occurrences (I'll change it and return back in a comment to see if you guys like that idea ). |
…serving all errors on multihost pool CLose()
…estNewMultiHostPool/multi-host_single_address
defer p.Unlock() | ||
for host, pool := range p.pools { | ||
poolErr := pool.Close() | ||
//preserve pool error if not nil but continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itamarhaber what do you think about the following solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely 🔨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 💯 but ci was failing tho
It's failing only due to coverage difference -0.06% with the added error concatenation. I believe we can merge it 👍 |
NewClientFromPool(pool *redis.Pool, name string) *Client
Close()
fixes #16, #9
simple example of two clients sharing the pool: