From 958947644a9e210b59fd2218907f0e666d4f9c2f Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 24 Sep 2015 01:23:24 -0700 Subject: [PATCH] taskd.pl: make sure no status messages are skipped Signed-off-by: Kyle J. McKay --- taskd/taskd.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/taskd/taskd.pl b/taskd/taskd.pl index ee2534f..4603297 100755 --- a/taskd/taskd.pl +++ b/taskd/taskd.pl @@ -415,14 +415,7 @@ while (1) { my ($rout, $eout, $nfound); do { my $wait; - $nextstatus += 60 while ($wait = $nextstatus - time) <= 0; - $nfound = select($rout=$fdset, undef, $eout=$fdset, $wait); - logmsg "select failed: $!" unless $nfound >= 0 || $!{EINTR}; my $now = time; - if ($idle_timeout && !$children && !$nfound && $now - $idlestart >= $idle_timeout) { - statmsg "idle timeout (@{[duration($idle_timeout)]}) exceeded now exiting"; - exit 0; - } if ($now >= $nextstatus) { my $statmsg = "STATUS: $children active"; my $idlesecs; @@ -430,6 +423,14 @@ while (1) { if !$children && ($idlesecs = $now - $idlestart) >= 2; statmsg $statmsg; } + $nextstatus += 60, $now = time while ($wait = $nextstatus - $now) <= 0; + $nfound = select($rout=$fdset, undef, $eout=$fdset, $wait); + logmsg "select failed: $!" unless $nfound >= 0 || $!{EINTR}; + $now = time; + if ($idle_timeout && !$children && !$nfound && $now - $idlestart >= $idle_timeout) { + statmsg "idle timeout (@{[duration($idle_timeout)]}) exceeded now exiting"; + exit 0; + } } while $nfound < 1; unless (accept(Client, Server)) { logmsg "accept failed: $!" unless $!{EINTR}; -- 2.11.4.GIT