nic-6443 commented on PR #14239:
URL: https://github.com/apache/apisix/pull/14239#issuecomment-7036971287

   Thanks for the careful read, all of these were real. Addressed in the latest 
commits:
   
   1. limit-conn lease expiry: the script now compares `PTTL` against `key_ttl 
* 1000` and extends with `PEXPIRE`; a non-positive `key_ttl` still runs `EXPIRE 
key ttl` as before. `limit-conn-conf-update.t` TEST 7 sets 2800 ms on a key 
with a 3 s `key_ttl` and checks that the next admission extends it. The 
limit-req bucket expiry had the same seconds comparison and got the same change.
   
   2. Delayed sync across Redis backends: the node-local accounting of the 
delayed syncer (synced quota, pending delta, lock) is now scoped to the Redis 
it syncs with (host/port/db/username, cluster name and nodes, or sentinel 
master/db/role/sentinels), so moving a counter to another backend starts its 
own accounting and a pending delta is flushed to the backend it was counted 
for. `limit-count-conf-update.t` TEST 8 is the regression you suggested: two 
requests pending for DB 14, switch to DB 15, one more request, and after both 
timers DB 14 holds 2 and DB 15 holds 1 (before: 3 and 0).
   
   3. Sliding window length: the window length is now in the key for sliding 
windows too. TEST 7 uses 1000000000 and 1000000001, which share window id 1, 
and checks that the second length starts fresh.
   
   On limit-req with a slower rate: a rejection now extends the bucket's expiry 
to the time its content needs to drain at the current rate (extend-only, like 
the admitted path), so continued rejections keep the debt. 
`limit-req-conf-update.t` TEST 5 fills a 1 req/s bucket, switches to 0.1 req/s 
and checks it's still rejected past the old 3 s expiry. A bucket that gets no 
request at all after the update still expires at the expiry its last request 
set; I documented that in the limit-req docs, since keeping it would need a 
write at update time.
   
   Test cleanup: the new suites no longer call `flush_all()`. Each file uses 
its own route id, and a new `delete_keys(pattern)` in `t/lib/test_redis.lua` 
removes only the keys of that route.
   
   Separately, the delayed sync now records the limit the synced remaining was 
computed with and rebases it on the reader's limit, so a new `count` applies 
immediately instead of after the next sync.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to