fix(cache): convert expiry to number (#9143)

# Which Problems Are Solved

When `LastUseAge` was configured properly, the Redis LUA script uses
manual cleanup for `MaxAge` based expiry. The expiry obtained from Redis
apears to be a string and was compared to an int, resulting in a script
error.

# How the Problems Are Solved

Convert expiry to number.

# Additional Changes

- none

# Additional Context

- Introduced in #8822
- LastUseAge was fixed in #9097
- closes https://github.com/zitadel/zitadel/issues/9140

(cherry picked from commit 56427cca50cc990bd168064d55559a0af9be4cdc)
This commit is contained in:
Tim Möhlmann 2025-01-07 13:51:06 +02:00 committed by adlerhurst
parent 7efd44126f
commit 3f59bcfac2
No known key found for this signature in database

View File

@ -13,8 +13,8 @@ end
-- max-age must be checked manually
local expiry = getCall("HGET", object_id, "expiry")
if not (expiry == nil) and expiry > 0 then
if getTime() > expiry then
if not (expiry == nil) and tonumber(expiry) > 0 then
if getTime() > tonumber(expiry) then
remove(object_id)
return nil
end