mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-05 16:12:32 +00:00
upvalue save alarm comparison
This commit is contained in:
parent
ded00765c6
commit
288cf4ae61
@ -1,7 +1,7 @@
|
||||
require("socket")
|
||||
settings.nodaemon = true
|
||||
--hostname = "irc.freenode.org"
|
||||
hostname = "127.0.0.1"
|
||||
hostname = "irc.freenode.org"
|
||||
--hostname = "127.0.0.1"
|
||||
port = 6667
|
||||
nick = "lbot01"
|
||||
chan = "##lfile01"
|
||||
|
6
lsyncd.c
6
lsyncd.c
@ -1610,6 +1610,12 @@ masterloop(lua_State *L)
|
||||
return;
|
||||
}
|
||||
lua_pop(L, 2);
|
||||
|
||||
if (lua_gettop(L)) {
|
||||
logstring("Error", "internal, stack is dirty.")
|
||||
l_stackdump(L);
|
||||
exit(-1); // ERRNO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
20
lsyncd.lua
20
lsyncd.lua
@ -2620,29 +2620,27 @@ function runner.getAlarm()
|
||||
----
|
||||
-- checks if current nearest alarm or a is earlier
|
||||
--
|
||||
local function checkAlarm(a)
|
||||
local function checkAlarm(alarm, a)
|
||||
if alarm == true or not a then
|
||||
-- already immediate or no new alarm
|
||||
return
|
||||
return alarm
|
||||
end
|
||||
if not alarm then
|
||||
alarm = a
|
||||
-- returns the ealier time
|
||||
if not alarm or a < alarm then
|
||||
return a
|
||||
else
|
||||
-- the earlier time
|
||||
if a < alarm then
|
||||
alarm = a
|
||||
end
|
||||
return alarm
|
||||
end
|
||||
end
|
||||
|
||||
-- checks all syncs for their earliest alarm
|
||||
for _, s in Syncs.iwalk() do
|
||||
checkAlarm(s:getAlarm())
|
||||
alarm = checkAlarm(alarm, s:getAlarm())
|
||||
end
|
||||
-- checks if a statusfile write has been delayed
|
||||
checkAlarm(StatusFile.getAlarm())
|
||||
alarm = checkAlarm(alarm, StatusFile.getAlarm())
|
||||
-- checks for an userAlarm
|
||||
checkAlarm(UserAlarms.getAlarm())
|
||||
alarm = checkAlarm(alarm, UserAlarms.getAlarm())
|
||||
|
||||
log("Debug","getAlarm returns: ",alarm)
|
||||
return alarm
|
||||
|
Loading…
Reference in New Issue
Block a user