Skip to content

Conversation

@tmacro
Copy link
Contributor

@tmacro tmacro commented Oct 21, 2025

Adds simple in memory storage for GCRA counters and cached bucket limit configurations.

Note for reviewers: This is being merged into a feature branch that has existing skeleton code. All unreviewed code will be gone over/reworked before merging into development/9.0

@tmacro tmacro requested review from a team and Copilot October 21, 2025 19:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces in-memory storage mechanisms for rate limiting functionality, including GCRA counters and cached bucket limit configurations. The implementation uses JavaScript Maps to provide simple, ephemeral storage for rate limit tracking.

Key Changes:

  • Added cache module with counter storage and cached config storage functionality
  • Implemented expiration mechanisms for both counters and cached configurations
  • Created comprehensive unit tests covering storage, retrieval, and expiration behaviors

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/api/apiUtils/rateLimit/cache.js Implements in-memory storage for GCRA counters and limit configurations with expiration logic
tests/unit/api/apiUtils/rateLimit/cache.js Provides unit test coverage for counter and config cache operations including expiration scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.60%. Comparing base (f44a1ec) to head (ce7fa89).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/api/apiUtils/rateLimit/cache.js 96.42% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/api/apiUtils/rateLimit/cache.js 96.42% <96.42%> (ø)
@@                               Coverage Diff                               @@
##           improvement/CLDSRV-766/bucket_rate_limiting    #5977      +/-   ##
===============================================================================
+ Coverage                                        82.57%   82.60%   +0.03%     
===============================================================================
  Files                                              194      195       +1     
  Lines                                            12324    12352      +28     
===============================================================================
+ Hits                                             10176    10203      +27     
- Misses                                            2148     2149       +1     
Flag Coverage Δ
ceph-backend-test 65.18% <0.00%> (-0.14%) ⬇️
file-ft-tests 66.02% <0.00%> (-0.16%) ⬇️
kmip-ft-tests 26.70% <0.00%> (-0.07%) ⬇️
mongo-v0-ft-tests 67.34% <0.00%> (-0.13%) ⬇️
mongo-v1-ft-tests 67.33% <0.00%> (-0.16%) ⬇️
multiple-backend 35.28% <0.00%> (-0.40%) ⬇️
quota-tests 31.90% <0.00%> (-0.05%) ⬇️
quota-tests-inflights 33.81% <0.00%> (-0.07%) ⬇️
unit 66.98% <96.42%> (+0.06%) ⬆️
utapi-v2-tests 32.99% <0.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant