-
-
Notifications
You must be signed in to change notification settings - Fork 185
fix: use redis Close() instead of Shutdown() #4140
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
Conversation
✅ Deploy Preview for go-feature-flag-doc-preview canceled.
|
|
/gemini review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4140 +/- ##
==========================================
+ Coverage 84.83% 84.93% +0.10%
==========================================
Files 139 138 -1
Lines 5677 5643 -34
==========================================
- Hits 4816 4793 -23
+ Misses 651 644 -7
+ Partials 210 206 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Code Review
This pull request correctly addresses a critical issue by replacing client.Shutdown() with client.Close(), preventing the accidental shutdown of the entire Redis server. The changes are robust, incorporating nil checks, setting the client to nil after closing to prevent reuse, and handling redis.ErrClosed for idempotency. The accompanying tests are thorough and cover the new logic well. I have provided a few suggestions to enhance code clarity and consistency.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
thomaspoignant
left a comment
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.
Hey @seanlion thanks a lot for this catch, I will merge this change and it will be part of the next release.
I've added some tests to validate all the cases of the shutdown function.
|
@thomaspoignant Thanks for review! |



What was the problem
Changes
clienttonilafter closing to prevent reuseredis.ErrClosederrors for idempotencyWhy Close() instead of Shutdown():
How to test the change
Related Issue
#4139
Checklist
README.mdand/website/docs)