mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-23 15:18:37 +00:00
Remove old debug prints, fix error() calls
This commit is contained in:
parent
c84e3d0e05
commit
8c71941f9c
2
lsyncd.c
2
lsyncd.c
@ -1329,7 +1329,6 @@ l_exec( lua_State *L )
|
|||||||
|
|
||||||
safeexit(L, -1 );
|
safeexit(L, -1 );
|
||||||
}
|
}
|
||||||
printf("JOJOJO\n");
|
|
||||||
pipe_text = lua_tolstring( L, 3, &pipe_len );
|
pipe_text = lua_tolstring( L, 3, &pipe_len );
|
||||||
|
|
||||||
if( strlen( pipe_text ) > 0 )
|
if( strlen( pipe_text ) > 0 )
|
||||||
@ -1414,7 +1413,6 @@ l_exec( lua_State *L )
|
|||||||
exit( -1 );
|
exit( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("has pipetext %d %d\n", pipe_text ? strlen(pipe_text) : 0 , pipe_len);
|
|
||||||
if( pipe_text )
|
if( pipe_text )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
16
lsyncd.lua
16
lsyncd.lua
@ -2920,16 +2920,13 @@ local Sync = ( function
|
|||||||
timestamp = now()
|
timestamp = now()
|
||||||
end
|
end
|
||||||
|
|
||||||
print(type(now()))
|
|
||||||
local nalarm = nil
|
local nalarm = nil
|
||||||
for i, c in ipairs(self.cron) do
|
for i, c in ipairs(self.cron) do
|
||||||
local na = c:get_next_occurrence(timestamp.seconds)
|
local na = c:get_next_occurrence(timestamp.seconds)
|
||||||
print("na", timestamp.seconds, na)
|
|
||||||
if nalarm == nil or nalarm > na then
|
if nalarm == nil or nalarm > na then
|
||||||
nalarm = na
|
nalarm = na
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print("calculated next cron:", nalarm)
|
|
||||||
if nalarm ~= nil then
|
if nalarm ~= nil then
|
||||||
self.nextCronAlarm = lsyncd.jiffies_from_seconds(nalarm)
|
self.nextCronAlarm = lsyncd.jiffies_from_seconds(nalarm)
|
||||||
end
|
end
|
||||||
@ -2962,7 +2959,6 @@ local Sync = ( function
|
|||||||
-- finds the nearest delay waiting to be spawned
|
-- finds the nearest delay waiting to be spawned
|
||||||
for _, d in self.delays:qpairs( )
|
for _, d in self.delays:qpairs( )
|
||||||
do
|
do
|
||||||
print("alarm", alarm2string(d.alarm), type(d.alarm))
|
|
||||||
if d.status == 'wait'
|
if d.status == 'wait'
|
||||||
then
|
then
|
||||||
if type(d.alarm) == "boolean" and d.alarm == true then
|
if type(d.alarm) == "boolean" and d.alarm == true then
|
||||||
@ -3378,22 +3374,18 @@ local Sync = ( function
|
|||||||
end
|
end
|
||||||
|
|
||||||
if config.crontab and loadCrontab() == false then
|
if config.crontab and loadCrontab() == false then
|
||||||
error("Sync ", config.name, " uses a crontab, but lua-crontab dependency is not available")
|
error("Sync ".. config.name.." uses a crontab, but lua-crontab dependency is not available", 0)
|
||||||
elseif config.crontab then
|
elseif config.crontab then
|
||||||
local cdata = {}
|
local cdata = {}
|
||||||
for i, v in ipairs( config.crontab ) do
|
for i, v in ipairs( config.crontab ) do
|
||||||
local ok, cd = pcall(crontab.make_raw_cron_data_from_string, v)
|
local ok, cd = pcall(crontab.make_raw_cron_data_from_string, v)
|
||||||
if ok then
|
if ok then
|
||||||
print ('getter')
|
|
||||||
local props = crontab.make_cron_properties(cd)
|
local props = crontab.make_cron_properties(cd)
|
||||||
local getter = crontab.make_next_occurrence_getter(props)
|
local getter = crontab.make_next_occurrence_getter(props)
|
||||||
print(getter)
|
|
||||||
for k, v in pairs( getter ) do
|
|
||||||
print(k,v)
|
|
||||||
end
|
|
||||||
table.insert( cdata, getter )
|
table.insert( cdata, getter )
|
||||||
else
|
else
|
||||||
error("Crontab rule ", i, " is not valid: ", cd, " . Rule: ", v)
|
error("Sync: "..config.name.." - crontab rule ".. i .." is not valid: ".. cd.. " . Rule: ".. v, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -3401,7 +3393,7 @@ local Sync = ( function
|
|||||||
if #cdata then
|
if #cdata then
|
||||||
s.cron = cdata
|
s.cron = cdata
|
||||||
else
|
else
|
||||||
error("Can't parse crontab data: "..cron, 2)
|
error("Can't parse crontab data: "..cron, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user