Skip to content

Commit

Permalink
fix(clustering/rpc): sync retry timeout due to block (#14195)
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlightIbuki authored and chronolaw committed Jan 21, 2025
1 parent dfc955e commit 3d9c63c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ local ipairs = ipairs
local ngx_null = ngx.null
local ngx_log = ngx.log
local ngx_ERR = ngx.ERR
local ngx_WARN = ngx.WARN
local ngx_INFO = ngx.INFO
local ngx_DEBUG = ngx.DEBUG

Expand Down Expand Up @@ -403,8 +404,8 @@ local function sync_once_impl(premature, retry_count)
-- retry if the version is not updated
retry_count = retry_count or 0

if retry_count > MAX_RETRY then
ngx_log(ngx_ERR, "sync_once retry count exceeded. retry_count: ", retry_count)
if retry_count >= MAX_RETRY then
ngx_log(ngx_WARN, "sync_once retry count exceeded. retry_count: ", retry_count)
return
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ for _, strategy in helpers.each_strategy() do
"no sync runs, version is " .. rep("0", 32), true, 10)

assert.logfile(name).has.line(
"sync_once retry count exceeded. retry_count: 6", true, 10)
"sync_once retry count exceeded. retry_count: 5", true, 10)
assert.logfile(name).has.no.line(
"assertion failed", true, 0)
assert.logfile(name).has.no.line(
"[error]", true, 0)

local name = nil

-- cp logs
for i = 0, 6 do
for i = 0, 5 do
assert.logfile(name).has.line(
"kong.sync.v2.get_delta ok: " .. i, true, 10)
end
Expand Down

0 comments on commit 3d9c63c

Please sign in to comment.