Skip to content

Feat/rate limit write #2

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Feat/rate limit write #2

wants to merge 18 commits into from

Conversation

ravilock
Copy link
Contributor

No description provided.

infezek and others added 18 commits June 19, 2025 18:44
Refactored ngx_http_limit_req_rw_module.c to modularize and clean up
shared memory zone access. Introduced a helper function
find_rate_limit_shm_zone_by_name to encapsulate the logic for locating
rate limit zones by name, reducing code duplication and improving
readability. Updated both read and write handlers to use this helper.
Also improved logging and error handling for missing or invalid zones.

Updated .gitignore to exclude .cache directory. Enhanced config script
to detect both 'msgpack-c' and 'msgpack' pkg-config packages for better
compatibility across platforms.
Refactored the rate limit entity update logic to:
- Move zone lookup and locking outside the entity loop for efficiency.
- Use direct key from message pack instead of converting to in_addr.
- Replace memcmp with ngx_memn2cmp for key comparison in rbtree.
- Fix entity array allocation and assignment.
- Improve error handling and logging.
- Remove redundant debug logs and streamline memory management.

This improves performance, correctness, and maintainability of the
rate limit state update handler.
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.

2 participants