Skip to content
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

fix(clustering/rpc): add random for timer‘s name #14241

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions kong/clustering/rpc/socket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ function _M:process_rpc_msg(payload, collection)

-- collection is nil, it means it is a single call
-- we should call async function
local name = string_format("JSON-RPC callback for node_id: %s, id: %d, method: %s",
self.node_id, payload_id or 0, payload_method)
-- random is for avoiding timer's name confliction
local name = string_format("JSON-RPC callback for node_id: %s, id: %d, rand: %d, method: %s",
self.node_id, payload_id or 0, math.random(10^5), payload_method)
ADD-SP marked this conversation as resolved.
Show resolved Hide resolved
res, err = kong.timer:named_at(name, 0, _M._dispatch, self, dispatch_cb, payload)

if not res and payload_id then
Expand Down
Loading