feat(BA-7363): publish the per-user rate limit to the shared Redis DB - #13784
Draft
jopemachine wants to merge 3 commits into
Draft
feat(BA-7363): publish the per-user rate limit to the shared Redis DB#13784jopemachine wants to merge 3 commits into
jopemachine wants to merge 3 commits into
Conversation
The web server needs the limit to reject over-limit requests before they reach the manager, and reading it from the session would freeze it at login time. The manager's rate limit middleware resolves the policy value on every authorized request anyway, so it republishes the value there under a `user-rate-limit.` key with the rate limit window as its TTL. A limit that stops being republished expires within that window, which is also when its rolling counter would expire. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Aug 14, 2026
Co-authored-by: octodog <mu001@lablup.com>
jopemachine
marked this pull request as draft
August 14, 2026 14:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 Stacked PRs
This PR is part of a 5-PR stack. Merge in order:
feat(BA-7364): deliver the login user id in the auth responsefeat(BA-7365): key the rate limit counter by user idfeat(BA-7362): move the per-user API rate limit to the user resource policyfeat(BA-7363): publish the per-user rate limit to the shared Redis DB← you are herefeat(BA-7365): add a per-user rate limit middleware to the web serverOnly the final tip (#13771) is guaranteed to build / pass CI; intermediate PRs are logical slices for reviewability.
Summary
set_user_rate_limit()/get_user_rate_limit()toValkeyRateLimitClient, storing the value under auser-rate-limit.<user_id>key in the rate limit DB that already holds the rolling counters.The web server reads this value instead of carrying the limit in its session token, which would have frozen it at login time for up to a week.
Resolves BA-7363.