Skip to content

Commit

Permalink
fix(vault): cleanup old count
Browse files Browse the repository at this point in the history
  • Loading branch information
windmgc committed Jun 11, 2024
1 parent bf3b914 commit 6df34cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kong/pdk/vault.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1248,19 +1248,22 @@ local function new(self)
if not reference then
-- invalid cache keys are removed (in general should never happen)
SECRETS_CACHE:delete(old_cache_key)
SECRETS_CACHE:delete(SECRETS_RETRY_KEY_PREFIX .. old_cache_key)
return nil, err
end

local strategy, err, config, new_cache_key, parsed_reference, config_hash = get_strategy(reference)
if not strategy then
-- invalid cache keys are removed (e.g. a vault entity could have been removed)
SECRETS_CACHE:delete(old_cache_key)
SECRETS_CACHE:delete(SECRETS_RETRY_KEY_PREFIX .. old_cache_key)
return nil, fmt("could not parse reference %s (%s)", reference, err)
end

if old_cache_key ~= new_cache_key then
-- config has changed, thus the old cache key can be removed
SECRETS_CACHE:delete(old_cache_key)
SECRETS_CACHE:delete(SECRETS_RETRY_KEY_PREFIX .. old_cache_key)
end

-- The ttl for this key, is the TTL + the resurrect time
Expand Down

0 comments on commit 6df34cf

Please sign in to comment.