apisix
apisix copied to clipboard
feat: ai rate limiting redis support
Description
Which issue(s) this PR fixes:
Fixes #12482
Notice
- I have updated the
limit-count-redis.luaandlimit-count-redis-cluster.luafiles to ensure they now support rate-limiting during the log phase. - I referred to the
limit-conn-redis.luafile as a guide while implementing rate-limiting in the log phase. - To ensure a clean testing environment, I added the
require("lib.test_redis").flush_all()function to every Redis rate-limiting test case. Without this addition, the tests could fail unpredictably. - I have adjusted the expected results in
limit-req-redis.tandlimit-req-redis-cluster.ttest cases. After thorough verification, the correct behavior is[200, 403, 403, 403]. Previously, the results appeared as[403, 403, 403, 403]due to Redis not being properly cleaned beforehand.
Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [x] I have updated the documentation to reflect this change
- [x] I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)
@Baoyuantop PTAL
@beardnick many thx for your contribution, some CI tests are failed, you can fix them
Hi @beardnick, please check these comments.