From bd704572e9505cfdeceb486de443ec0a6a37f144 Mon Sep 17 00:00:00 2001 From: Chrono Date: Thu, 9 Jan 2025 10:31:09 +0800 Subject: [PATCH] fix(clustering/rpc): check return value of `kong.timer` (#14112) This PR follows #14089. KAG-6114 --- kong/clustering/services/sync/rpc.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kong/clustering/services/sync/rpc.lua b/kong/clustering/services/sync/rpc.lua index 5af99ca68c6..b46f7960c08 100644 --- a/kong/clustering/services/sync/rpc.lua +++ b/kong/clustering/services/sync/rpc.lua @@ -419,7 +419,12 @@ function _M:sync_once(delay) return true end - return kong.timer:named_at(name, delay or 0, sync_once_impl, 0) + local ok, err = kong.timer:named_at(name, delay or 0, sync_once_impl, 0) + if not ok then + return nil, err + end + + return true end @@ -440,7 +445,12 @@ function _M:sync_every(delay, stop) return true end - return kong.timer:named_every(name, delay, sync_handler) + local ok, err = kong.timer:named_every(name, delay, sync_handler) + if not ok then + return nil, err + end + + return true end