-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clustering/rpc): connection lost event #14257
base: master
Are you sure you want to change the base?
Conversation
Precondition for KAG-6178
@@ -605,16 +605,16 @@ function _M:connect(premature, node_id, host, path, cert, key) | |||
local meta_cap = resp_headers["sec_websocket_protocol"] | |||
|
|||
if meta_cap ~= RPC_META_V1 then | |||
ngx_log(ngx_ERR, _log_prefix, "did not support protocol : ", meta_cap) | |||
err = "did not support protocol : " .. (type(meta_cap) == "string" and meta_cap or "unknown") | |||
c:send_close() -- can't do much if this fails | |||
goto err | |||
end | |||
|
|||
-- if timeout (default is 5s) we will close the connection | |||
local ok, err = self:_meta_call(c, meta_cap, node_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local ok, err = self:_meta_call(c, meta_cap, node_id) | |
ok, err = self:_meta_call(c, meta_cap, node_id) |
@@ -587,7 +587,7 @@ function _M:connect(premature, node_id, host, path, cert, key) | |||
|
|||
local ok, err = c:connect(uri, opts) | |||
if not ok then | |||
ngx_log(ngx_ERR, _log_prefix, "unable to connect to peer: ", err) | |||
err = "unable to connect to peer: " .. (err or "unknown error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the log?
local worker_events = assert(kong.worker_events) | ||
|
||
-- notify this worker | ||
local ok, err = worker_events.post_local("clustering:jsonrpc", "connection_lost") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may cause duplicated event when connection disconnected, what's your opinion? how do we distinguish them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it is dp side event.
Summary
Emit an event when the connection is lost
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
Precondition for KAG-6178