Skip to content

Commit

Permalink
run ttl processing before schema:process_auto_fields()
Browse files Browse the repository at this point in the history
  • Loading branch information
chobits committed Sep 7, 2023
1 parent f971ef7 commit 91f1294
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kong/db/strategies/off/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,12 @@ local function page_for_key(self, key, size, offset, options)
return nil, "stale data detected while paginating"
end

item = schema:process_auto_fields(item, "select", true, PROCESS_AUTO_FIELDS_OPTS)

if schema.ttl then
item = process_ttl_field(item)
end

if item then
ret[ret_idx] = item
ret[ret_idx] = schema:process_auto_fields(item, "select", true, PROCESS_AUTO_FIELDS_OPTS)
ret_idx = ret_idx + 1
end
end
Expand All @@ -234,12 +232,15 @@ local function select_by_key(schema, key)
return nil, err
end

entity = schema:process_auto_fields(entity, "select", true, PROCESS_AUTO_FIELDS_OPTS)

if schema.ttl then
entity = process_ttl_field(entity)
if not entity then
return nil
end
end

entity = schema:process_auto_fields(entity, "select", true, PROCESS_AUTO_FIELDS_OPTS)

return entity
end

Expand Down

0 comments on commit 91f1294

Please sign in to comment.