fix: data loss bug when move + delete (#162)

This commit is contained in:
Steven Arcangeli 2023-08-25 18:56:30 -07:00
parent 2fde9d84fc
commit f86d49446a
2 changed files with 21 additions and 8 deletions

View file

@ -191,7 +191,7 @@ M.enforce_action_order = function(actions)
local function get_deps(action)
local ret = {}
if action.type == "delete" then
return ret
src_trie:accum_children_of(action.url, ret)
elseif action.type == "create" then
-- Finish operating on parents first
-- e.g. NEW /a BEFORE NEW /a/b
@ -289,7 +289,7 @@ M.enforce_action_order = function(actions)
-- We've detected a move cycle (e.g. MOVE /a -> /b + MOVE /b -> /a)
-- Split one of the moves and retry
local intermediate_url =
string.format("%s__oil_tmp_%05d", loop_action.src_url, math.random(999999))
string.format("%s__oil_tmp_%05d", loop_action.src_url, math.random(999999))
local move_1 = {
type = "move",
entry_type = loop_action.entry_type,