Finish full sync cron trigger

This commit is contained in:
Daniel Poelzleithner 2022-03-31 03:54:21 +02:00
parent 5b42d69193
commit 66b038e394
4 changed files with 34 additions and 1 deletions

View File

@ -129,7 +129,16 @@ direct.action = function(inlet)
event.targetPath,
event2.targetPath
)
elseif event.etype == 'Full' then
local tp = event.targetPath
-- extra security check
if tp == '' or tp == '/' or not tp then
error('Refusing to erase your harddisk!')
end
-- trigger full sync function
direct.full(event)
else
log('Warn', 'ignored an event of type "',event.etype, '"')
inlet.discardEvent(event)
@ -177,6 +186,12 @@ end
--
direct.init = default.rsync.init
--
-- Spawns the recursive startup sync
-- (currently) identical to default rsync.
--
direct.full = default.rsync.full
--
-- Checks the configuration.
--

View File

@ -310,6 +310,16 @@ end
-- Spawns the recursive startup sync.
--
rsync.init = function
(
event
)
return rsync.full(event)
end
--
-- Triggers a full sync event
--
rsync.full = function
(
event
)

View File

@ -42,6 +42,7 @@ default.checkgauge = {
delay = true,
exitcodes = true,
init = true,
full = true,
maxDelays = true,
maxProcesses = true,
onAttrib = true,
@ -50,6 +51,7 @@ default.checkgauge = {
onDelete = true,
onStartup = true,
onMove = true,
onFull = true,
prepare = true,
source = true,
target = true,

View File

@ -1006,6 +1006,11 @@ local Combiner = ( function
return 'stack'
end
-- A full sync does not affect us
if d1.etype == 'Full' or d2.etype == 'Full' then
return nil
end
-- two normal events
if d1.etype ~= 'Move' and d2.etype ~= 'Move'
then
@ -3027,7 +3032,7 @@ local Sync = ( function
-- time fo a full sync
log('Info', 'Crontab triggered full sync')
-- TODO
self:delay("Full", timestamp, "/", nil)
updateNextCronAlarm(self, timestamp)
end
@ -4144,6 +4149,7 @@ local Syncs = ( function
and not config.onModify
and not config.onDelete
and not config.onMove
and not config.onFull
then
local info = debug.getinfo( 3, 'Sl' )