Skip to content

Commit

Permalink
fix(clustering/rpc): add random for timer‘s name (#14241)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw authored Feb 5, 2025
1 parent 004eee9 commit 6617d58
Showing 1 changed file with 3 additions and 2 deletions.
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)
res, err = kong.timer:named_at(name, 0, _M._dispatch, self, dispatch_cb, payload)

if not res and payload_id then
Expand Down

1 comment on commit 6617d58

@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:6617d58775c5e0ef0437f3938df077babbe3c331
Artifacts available https://github.com/Kong/kong/actions/runs/13153865628

Please sign in to comment.