Skip to content

Commit

Permalink
clean rpc.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Sep 30, 2024
1 parent 81dfa41 commit 8dd2884
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ function _M:sync_once(delay)
for _, delta in ipairs(ns_delta.deltas) do
local delta_type = delta.type
local delta_row = delta.row
local ev

if delta_row ~= ngx_null then
-- upsert the entity
Expand All @@ -259,8 +260,7 @@ function _M:sync_once(delay)
return nil, err
end

crud_events_n = crud_events_n + 1
crud_events[crud_events_n] = { delta_type, crud_event_type, delta_row, old_entity, }
ev = { delta_type, crud_event_type, delta_row, old_entity, }

else
-- delete the entity
Expand All @@ -276,10 +276,12 @@ function _M:sync_once(delay)
end
end

crud_events_n = crud_events_n + 1
crud_events[crud_events_n] = { delta_type, "delete", old_entity, }
ev = { delta_type, "delete", old_entity, }
end

crud_events_n = crud_events_n + 1
crud_events[crud_events_n] = ev

-- XXX TODO: could delta.version be nil or ngx.null
if type(delta.version) == "number" and delta.version ~= version then
version = delta.version
Expand Down

0 comments on commit 8dd2884

Please sign in to comment.