This is an automated email from the ASF dual-hosted git repository. nic443 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push: new 9ae24032b fix: add exptime to ewma shared dict items (#12557) 9ae24032b is described below commit 9ae24032b6177daa6dfd31de04bfedc435a842d5 Author: Nic <qiany...@api7.ai> AuthorDate: Mon Sep 1 11:31:28 2025 +0800 fix: add exptime to ewma shared dict items (#12557) Signed-off-by: Nic <qiany...@api7.ai> --- apisix/balancer/ewma.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apisix/balancer/ewma.lua b/apisix/balancer/ewma.lua index c533a01c6..0834397b9 100644 --- a/apisix/balancer/ewma.lua +++ b/apisix/balancer/ewma.lua @@ -18,6 +18,7 @@ local next = next local error = error local DECAY_TIME = 10 -- this value is in seconds +local SHM_TTL = 60 local LOCK_KEY = ":ewma_key" local shm_ewma = ngx_shared["balancer-ewma"] @@ -58,7 +59,7 @@ local function decay_ewma(ewma, last_touched_at, rtt, now) end local function store_stats(upstream, ewma, now) - local success, err, forcible = shm_last_touched_at:set(upstream, now) + local success, err, forcible = shm_last_touched_at:set(upstream, now, SHM_TTL) if not success then core.log.error("shm_last_touched_at:set failed: ", err) end @@ -66,7 +67,7 @@ local function store_stats(upstream, ewma, now) core.log.warn("shm_last_touched_at:set valid items forcibly overwritten") end - success, err, forcible = shm_ewma:set(upstream, ewma) + success, err, forcible = shm_ewma:set(upstream, ewma, SHM_TTL) if not success then core.log.error("shm_ewma:set failed: ", err) end