Skip to content

Commit

Permalink
refactor(clustering/rpc): wait 5 seconds for rpc queue (#14189)
Browse files Browse the repository at this point in the history
In #14040 we changed the timeout from 5 to 0.5, but that is not necessary and may cause checking queue frequently,
so this PR revert this small change.

KAG-5934
  • Loading branch information
chronolaw authored Jan 22, 2025
1 parent cb31e28 commit be10aa9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kong/clustering/rpc/socket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,22 +347,21 @@ function _M:start()
local batch_requests = {}

while not exiting() do
-- 0.5 seconds for not waiting too long
local payload, err = self.outgoing:pop(0.5)
-- TODO: find the more proper timeout
local payload, err = self.outgoing:pop(5)
if err then
return nil, err
end

-- timeout
if not payload then
local n = #batch_requests
if n > 0 then
if not isempty(batch_requests) then
local bytes, err = self.wb:send_binary(compress_payload(batch_requests))
if not bytes then
return nil, err
end

ngx_log(ngx_DEBUG, "[rpc] sent batch RPC call: ", n)
ngx_log(ngx_DEBUG, "[rpc] sent batch RPC call: ", #batch_requests)

tb_clear(batch_requests)
end
Expand Down

1 comment on commit be10aa9

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong-dev:be10aa90ddaeecf2b55d8ec6872dc92797ad2c03
Artifacts available https://github.com/Kong/kong/actions/runs/12900409027

Please sign in to comment.