From 09d5bc4f880990db32403d09c6f8822525eea3cb Mon Sep 17 00:00:00 2001 From: chronolaw Date: Tue, 14 Jan 2025 09:40:22 +0800 Subject: [PATCH] VER_PREFIX_LEN --- kong/clustering/services/sync/strategies/postgres.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kong/clustering/services/sync/strategies/postgres.lua b/kong/clustering/services/sync/strategies/postgres.lua index fc4738ed8cb..06da15cabdc 100644 --- a/kong/clustering/services/sync/strategies/postgres.lua +++ b/kong/clustering/services/sync/strategies/postgres.lua @@ -9,6 +9,7 @@ local ngx_null = ngx.null -- version string should look like: "v02_0000" local VER_PREFIX = "v02_" +local VER_PREFIX_LEN = #VER_PREFIX local VERSION_FMT = VER_PREFIX .. "%028x" @@ -59,7 +60,7 @@ end function _M:is_valid_version(str) - return sub(str, 1, 4) == VER_PREFIX + return sub(str, 1, VER_PREFIX_LEN) == VER_PREFIX end