From 3055bbf087dd12eea4ded943823544684642fba7 Mon Sep 17 00:00:00 2001 From: Qi Date: Thu, 13 Jun 2024 02:55:35 +0000 Subject: [PATCH] refactor(queue): construct the key of queue efficiently --- kong/tools/queue.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kong/tools/queue.lua b/kong/tools/queue.lua index a88d0f37955b..7db38e0c6206 100644 --- a/kong/tools/queue.lua +++ b/kong/tools/queue.lua @@ -94,9 +94,17 @@ local Queue_mt = { __index = Queue } +-- string buffer for constructing queue keys efficiently +local buf = require("string.buffer").new(32) + local function _make_queue_key(name) - return (workspaces.get_workspace_id() or "") .. "." .. name + local key = buf:put( + workspaces.get_workspace_id() or "", + ".", + name + ):get() + return key end