mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-04 19:03:17 +00:00
fix alarm calculation
This commit is contained in:
parent
a244d49ea4
commit
a60cf7c541
26
lsyncd.lua
26
lsyncd.lua
@ -2933,26 +2933,34 @@ local Sync = ( function
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- first checks if more processes could be spawned
|
-- first checks if more processes could be spawned
|
||||||
if self.processes:size( ) < self.config.maxProcesses
|
if self.processes:size( ) > self.config.maxProcesses
|
||||||
then
|
then
|
||||||
-- finds the nearest delay waiting to be spawned
|
return false
|
||||||
for _, d in self.delays:qpairs( )
|
end
|
||||||
do
|
|
||||||
if d.status == 'wait'
|
-- finds the nearest delay waiting to be spawned
|
||||||
then
|
for _, d in self.delays:qpairs( )
|
||||||
if rv == false or d.alarm < rv then
|
do
|
||||||
|
print("alarm", alarm2string(d.alarm), type(d.alarm))
|
||||||
|
if d.status == 'wait'
|
||||||
|
then
|
||||||
|
if type(d.alarm) == "boolean" and d.alarm == true then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if type(d.alarm) == "userdata" then
|
||||||
|
if rv == false or
|
||||||
|
d.alarm < rv then
|
||||||
rv = d.alarm
|
rv = d.alarm
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if rv == false and self.nextCronAlarm ~= false then
|
if rv == false and self.nextCronAlarm ~= false then
|
||||||
rv = self.nextCronAlarm
|
rv = self.nextCronAlarm
|
||||||
elseif rv == true then
|
|
||||||
elseif self.nextCronAlarm ~= false and self.nextCronAlarm < rv then
|
elseif self.nextCronAlarm ~= false and self.nextCronAlarm < rv then
|
||||||
rv = self.nextCronAlarm
|
rv = self.nextCronAlarm
|
||||||
end
|
end
|
||||||
|
|
||||||
-- nothing to spawn
|
-- nothing to spawn
|
||||||
return rv
|
return rv
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user