ok do not store nil in local values

This commit is contained in:
Axel Kittenberger 2010-12-01 13:25:05 +00:00
parent 288cf4ae61
commit b5fb18cda5
1 changed files with 12 additions and 11 deletions

View File

@ -1233,7 +1233,7 @@ local Sync = (function()
-- --
local function getAlarm(self) local function getAlarm(self)
if self.processes:size() >= self.config.maxProcesses then if self.processes:size() >= self.config.maxProcesses then
return nil return false
end end
-- first checks if more processses could be spawned -- first checks if more processses could be spawned
@ -1247,7 +1247,7 @@ local Sync = (function()
end end
-- nothing to spawn -- nothing to spawn
return nil return false
end end
@ -2224,7 +2224,7 @@ local UserAlarms = (function()
-- --
local function getAlarm() local function getAlarm()
if #alarms == 0 then if #alarms == 0 then
return nil return false
else else
return alarms[1].timestamp return alarms[1].timestamp
end end
@ -2620,27 +2620,28 @@ function runner.getAlarm()
---- ----
-- checks if current nearest alarm or a is earlier -- checks if current nearest alarm or a is earlier
-- --
local function checkAlarm(alarm, a) local function checkAlarm(a)
if a == nil then
error("got nil alarm")
end
if alarm == true or not a then if alarm == true or not a then
-- already immediate or no new alarm -- already immediate or no new alarm
return alarm return
end end
-- returns the ealier time -- returns the ealier time
if not alarm or a < alarm then if not alarm or a < alarm then
return a alarm = a
else
return alarm
end end
end end
-- checks all syncs for their earliest alarm -- checks all syncs for their earliest alarm
for _, s in Syncs.iwalk() do for _, s in Syncs.iwalk() do
alarm = checkAlarm(alarm, s:getAlarm()) checkAlarm(s:getAlarm())
end end
-- checks if a statusfile write has been delayed -- checks if a statusfile write has been delayed
alarm = checkAlarm(alarm, StatusFile.getAlarm()) checkAlarm(StatusFile.getAlarm())
-- checks for an userAlarm -- checks for an userAlarm
alarm = checkAlarm(alarm, UserAlarms.getAlarm()) checkAlarm(UserAlarms.getAlarm())
log("Debug","getAlarm returns: ",alarm) log("Debug","getAlarm returns: ",alarm)
return alarm return alarm