From f189dac232321ae59c1aaa53bc788b9751d17852 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 6 Jan 2025 15:15:42 +0800 Subject: [PATCH] is_invalid_version --- kong/clustering/services/sync/rpc.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kong/clustering/services/sync/rpc.lua b/kong/clustering/services/sync/rpc.lua index 035aed2c8a1..17f3e0cfaaf 100644 --- a/kong/clustering/services/sync/rpc.lua +++ b/kong/clustering/services/sync/rpc.lua @@ -59,13 +59,13 @@ local function get_current_version() end -local is_empty_version +local is_invalid_version do local byte = string.byte local CHAR_V = byte("V") -- version string must start with char 'V' - is_empty_version = function(v) + is_invalid_version = function(v) return byte(v) ~= CHAR_V end end @@ -117,7 +117,8 @@ function _M:init_cp(manager) return nil, err end - if is_empty_version(default_namespace_version) or + -- string comparison effectively does the same as number comparison + if is_invalid_version(default_namespace_version) or default_namespace_version < latest_version then return full_sync_result() end