Skip to content

Conversation

@Tusharjamdade
Copy link

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:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

Signed-off-by: Tushar Jamdade <tushar@DESKTOP-0D1FVJR.localdomain>
@Tusharjamdade
Copy link
Author

Hi @bupd,
Could you please review this and let me know if there are any additional changes or improvements needed?
Thank you!

@Tusharjamdade Tusharjamdade changed the title release-note/bug fix: handle Redis errors correctly in connection limiter Dec 25, 2025
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)
Copy link
Contributor

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
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.54%. Comparing base (c8c11b4) to head (43b21b7).
⚠️ Report is 611 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 46.54% <ø> (+1.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 178 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@stonezdj stonezdj left a 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>
@Tusharjamdade
Copy link
Author

Hi @stonezdj,
The code now returns HTTP 500 when Acquire() fails. Please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle Redis errors gracefully in connection limiter

4 participants