mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-11-16 01:47:08 +00:00
cleanups, tests adaption
This commit is contained in:
parent
62517c2922
commit
b030d4b898
@ -15,20 +15,11 @@
|
|||||||
--
|
--
|
||||||
--
|
--
|
||||||
|
|
||||||
if not default
|
if not default then error( 'default not loaded' ); end
|
||||||
then
|
|
||||||
error( 'default not loaded' );
|
|
||||||
end
|
|
||||||
|
|
||||||
if not default.rsync
|
if not default.rsync then error( 'default.rsync not loaded' ); end
|
||||||
then
|
|
||||||
error( 'default.rsync not loaded' );
|
|
||||||
end
|
|
||||||
|
|
||||||
if default.rsyncssh
|
if default.rsyncssh then error( 'default-rsyncssh already loaded' ); end
|
||||||
then
|
|
||||||
error( 'default-rsyncssh already loaded' );
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- rsyncssh extends default.rsync
|
-- rsyncssh extends default.rsync
|
||||||
@ -360,7 +351,7 @@ rsyncssh.collect = function
|
|||||||
|
|
||||||
if not agent.isList and agent.etype == 'Init'
|
if not agent.isList and agent.etype == 'Init'
|
||||||
then
|
then
|
||||||
local rc = config.rsyncExitCodes[exitcode]
|
local rc = config.rsyncExitCodes[ exitcode ]
|
||||||
|
|
||||||
if rc == 'ok'
|
if rc == 'ok'
|
||||||
then
|
then
|
||||||
@ -570,7 +561,7 @@ rsyncssh.exitcodes = false
|
|||||||
--
|
--
|
||||||
-- rsync exit codes
|
-- rsync exit codes
|
||||||
--
|
--
|
||||||
rsyncssh.rsyncExitCodes = default.rsync.exitCodes
|
rsyncssh.rsyncExitCodes = default.rsync.exitcodes
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Exitcodes of ssh and what to do.
|
-- Exitcodes of ssh and what to do.
|
||||||
|
@ -36,8 +36,6 @@ local assignable =
|
|||||||
{
|
{
|
||||||
dpos = true,
|
dpos = true,
|
||||||
etype = true,
|
etype = true,
|
||||||
path = true,
|
|
||||||
path2 = true,
|
|
||||||
status = true,
|
status = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,15 +183,9 @@ local function collect
|
|||||||
|
|
||||||
alarm = now() + alarm
|
alarm = now() + alarm
|
||||||
|
|
||||||
for _, d in ipairs( delay )
|
for _, d in ipairs( delay ) do d:wait( alarm ) end
|
||||||
do
|
|
||||||
d:wait( alarm )
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
for _, d in ipairs( delay )
|
for _, d in ipairs( delay ) do removeDelay( self, d ) end
|
||||||
do
|
|
||||||
removeDelay( self, d )
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
log( 'Delay','Finished list = ',exitcode )
|
log( 'Delay','Finished list = ',exitcode )
|
||||||
@ -368,10 +362,7 @@ local function delay
|
|||||||
' event.'
|
' event.'
|
||||||
)
|
)
|
||||||
|
|
||||||
if #self.delays > 0
|
if #self.delays > 0 then stack( self.delays:last( ), nd ) end
|
||||||
then
|
|
||||||
stack( self.delays:last( ), nd )
|
|
||||||
end
|
|
||||||
|
|
||||||
nd.dpos = self.delays:push( nd )
|
nd.dpos = self.delays:push( nd )
|
||||||
|
|
||||||
@ -528,10 +519,7 @@ local function getDelays
|
|||||||
do
|
do
|
||||||
local tr = true
|
local tr = true
|
||||||
|
|
||||||
if test
|
if test then tr = test( InletFactory.d2e( d ) ) end
|
||||||
then
|
|
||||||
tr = test( InletFactory.d2e( d ) )
|
|
||||||
end
|
|
||||||
|
|
||||||
if tr == 'break' then break end
|
if tr == 'break' then break end
|
||||||
|
|
||||||
@ -860,10 +848,10 @@ local function new
|
|||||||
-- since this way it will raise any issues of mindelay or delay
|
-- since this way it will raise any issues of mindelay or delay
|
||||||
-- not being numbers as well
|
-- not being numbers as well
|
||||||
|
|
||||||
if not ( config.mindelay >= config.delay )
|
if not ( config.mindelay <= config.delay )
|
||||||
then
|
then
|
||||||
error(
|
error(
|
||||||
'mindelay (= '..config.mindelay.. ') must be larger '..
|
'mindelay (= '..config.mindelay.. ') must be smaller '..
|
||||||
'or equal than delay (= '..config.delay..')',
|
'or equal than delay (= '..config.delay..')',
|
||||||
level
|
level
|
||||||
)
|
)
|
||||||
|
@ -16,9 +16,13 @@ churn( srcdir, 100, true )
|
|||||||
local logs = { }
|
local logs = { }
|
||||||
local pid = spawn(
|
local pid = spawn(
|
||||||
'./lsyncd',
|
'./lsyncd',
|
||||||
'-nodaemon',
|
'-c',
|
||||||
'-delay', '5',
|
'sync{ '
|
||||||
'-rsync', srcdir, trgdir,
|
.. 'default.rsync, '
|
||||||
|
.. 'delay = 5, '
|
||||||
|
.. 'source = "'..srcdir..'", '
|
||||||
|
.. 'target = "'..trgdir..'" '
|
||||||
|
.. '}',
|
||||||
table.unpack( logs )
|
table.unpack( logs )
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +30,7 @@ cwriteln( 'waiting for Lsyncd to startup' )
|
|||||||
|
|
||||||
posix.sleep( 1 )
|
posix.sleep( 1 )
|
||||||
|
|
||||||
churn( srcdir, 500, false )
|
churn( srcdir, 100, false )
|
||||||
|
|
||||||
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
|
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
|
||||||
|
|
||||||
|
@ -21,20 +21,21 @@ logs = { '-log', 'Delay' }
|
|||||||
|
|
||||||
local pid = spawn(
|
local pid = spawn(
|
||||||
'./lsyncd',
|
'./lsyncd',
|
||||||
'-nodaemon',
|
'-c',
|
||||||
'-delay',
|
'sync{ '
|
||||||
'5',
|
.. 'default.rsyncssh, '
|
||||||
'-rsyncssh',
|
.. 'delay = 5, '
|
||||||
srcdir,
|
.. 'source = "'..srcdir..'", '
|
||||||
'localhost',
|
.. 'host = "localhost", '
|
||||||
trgdir,
|
.. 'targetdir = "'..trgdir..'" '
|
||||||
|
.. '}',
|
||||||
table.unpack(logs)
|
table.unpack(logs)
|
||||||
)
|
)
|
||||||
|
|
||||||
cwriteln( 'waiting for Lsyncd to startup' )
|
cwriteln( 'waiting for Lsyncd to startup' )
|
||||||
posix.sleep( 1 )
|
posix.sleep( 1 )
|
||||||
|
|
||||||
churn( srcdir, 150, false )
|
churn( srcdir, 100, false )
|
||||||
|
|
||||||
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
|
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
|
||||||
posix.sleep( 10 )
|
posix.sleep( 10 )
|
||||||
|
Loading…
Reference in New Issue
Block a user