apisix icon indicating copy to clipboard operation
apisix copied to clipboard

feat: ai rate limiting redis support

Open beardnick opened this issue 2 months ago • 3 comments

Description

Which issue(s) this PR fixes:

Fixes #12482

Notice
  • I have updated the limit-count-redis.lua and limit-count-redis-cluster.lua files to ensure they now support rate-limiting during the log phase.
  • I referred to the limit-conn-redis.lua file 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.t and limit-req-redis-cluster.t test 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)

beardnick avatar Nov 16 '25 07:11 beardnick

@Baoyuantop PTAL

beardnick avatar Nov 16 '25 07:11 beardnick

@beardnick many thx for your contribution, some CI tests are failed, you can fix them

membphis avatar Nov 17 '25 02:11 membphis

Hi @beardnick, please check these comments.

Baoyuantop avatar Dec 03 '25 06:12 Baoyuantop