-
Notifications
You must be signed in to change notification settings - Fork 5.1k
fix: handle Redis errors correctly in connection limiter #22679
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
base: main
Are you sure you want to change the base?
fix: handle Redis errors correctly in connection limiter #22679
Conversation
Signed-off-by: Tushar Jamdade <tushar@DESKTOP-0D1FVJR.localdomain>
|
Hi @bupd, |
| allowed, err := connection.Limiter.Acquire(ctx, client, key, p.MaxUpstreamConnection()) | ||
| if err != nil { | ||
| // Redis unavailable or script error → do NOT return 429 | ||
| log.Errorf("connection limiter error (blob), skipping rate limit: %v", err) |
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.
Previous logic will return 429, now it should return 500 instead?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22679 +/- ##
==========================================
+ Coverage 45.36% 46.54% +1.17%
==========================================
Files 244 252 +8
Lines 13333 14273 +940
Branches 2719 2931 +212
==========================================
+ Hits 6049 6643 +594
- Misses 6983 7273 +290
- Partials 301 357 +56
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
stonezdj
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.
Please return 500 when the Acquire return error
Signed-off-by: Tushar Jamdade <tushar@DESKTOP-0D1FVJR.localdomain>
|
Hi @stonezdj, |
Thank you for contributing to Harbor!
Comprehensive Summary of your change
Fixes incorrect HTTP 429 responses when Redis is unavailable in the connection limiter.
Redis errors are now handled gracefully instead of being treated as rate-limit exhaustion
Issue being fixed
Fixes #22675
Please indicate you've done the following: