Skip to content

Commit

Permalink
ngx.timer
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Nov 19, 2024
1 parent 53d7f0a commit 37af7ed
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kong/clustering/rpc/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ function _M:handle_websocket()

-- check if client handshake success in 2 seconds
ngx.timer.at(2, function(premature)
if premature then
return
end

if not self.client_capabilities[node_id] then
s:stop()
end
Expand Down Expand Up @@ -429,8 +433,14 @@ function _M:connect(premature, node_id, host, path, cert, key)
self:_add_socket(s)

ngx.timer.at(0, function(premature)
if premature then
return
end

local retry_count = 5

-- retry
for i = 1, 5 do
for i = 1, retry_count do
local ok, err = self:_meta_call("control_plane", s, meta_rpc_call)
if ok then
return
Expand Down

0 comments on commit 37af7ed

Please sign in to comment.