Log source of next alarm as well

This commit is contained in:
Daniel Poelzleithner 2022-03-30 23:03:12 +02:00
parent c8fbe955fe
commit 95f8ea67dd
1 changed files with 10 additions and 8 deletions

View File

@ -6024,13 +6024,15 @@ function runner.getAlarm
if lsyncdStatus ~= 'run' then return false end if lsyncdStatus ~= 'run' then return false end
local alarm = false local alarm = false
local alarmSource = ""
-- --
-- Checks if 'a' is sooner than the 'alarm' up-value. -- Checks if 'a' is sooner than the 'alarm' up-value.
-- --
local function checkAlarm local function checkAlarm
( (
a -- alarm time a, -- alarm time
src -- name of subsystem
) )
if a == nil then error( 'got nil alarm' ) end if a == nil then error( 'got nil alarm' ) end
@ -6045,6 +6047,7 @@ function runner.getAlarm
if not alarm or a < alarm if not alarm or a < alarm
then then
alarm = a alarm = a
alarmSource = src
end end
end end
@ -6052,12 +6055,13 @@ function runner.getAlarm
-- checks all syncs for their earliest alarm, -- checks all syncs for their earliest alarm,
-- but only if the global process limit is not yet reached. -- but only if the global process limit is not yet reached.
-- --
if not uSettings.maxProcesses if not uSettings.maxProcesses
or processCount < uSettings.maxProcesses or processCount < uSettings.maxProcesses
then then
for _, s in Syncs.iwalk( ) for _, s in Syncs.iwalk( )
do do
checkAlarm( s:getAlarm( ) ) checkAlarm( s:getAlarm( ), s.config.name )
end end
else else
log( log(
@ -6066,15 +6070,13 @@ function runner.getAlarm
) )
end end
-- checks for tunnel alarm -- checks for tunnel alarm
checkAlarm( Tunnels.getAlarm( ) ) checkAlarm( Tunnels.getAlarm( ), "Tunnels" )
-- checks if a statusfile write has been delayed -- checks if a statusfile write has been delayed
checkAlarm( StatusFile.getAlarm( ) ) checkAlarm( StatusFile.getAlarm( ), "StatusFile" )
-- checks for an userAlarm -- checks for an userAlarm
checkAlarm( UserAlarms.getAlarm( ) ) checkAlarm( UserAlarms.getAlarm( ), "UserAlarms" )
log( 'Alarm', 'runner.getAlarm returns: ', alarm, " Source:", alarmSource )
log( 'Alarm', 'runner.getAlarm returns: ', alarm )
return alarm return alarm
end end