From 4cdf1a270d48642ebbd0a2f9897ffe776d266100 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 21 Sep 2013 19:38:02 +0000 Subject: [PATCH] hydra-queue-runner: Set the start time properly --- src/script/hydra-queue-runner | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/script/hydra-queue-runner b/src/script/hydra-queue-runner index e63c0315..56467086 100755 --- a/src/script/hydra-queue-runner +++ b/src/script/hydra-queue-runner @@ -28,7 +28,7 @@ sub unlockDeadBuilds { my $pid = $build->locker; my $unlock = 0; if ($pid == $$) { - if (!defined $lastTime || $build->starttime < $lastTime - 180) { + if (!defined $lastTime || $build->starttime < $lastTime - 300) { $unlock = 1; } } elsif (kill(0, $pid) != 1) { # see if we can signal the process @@ -36,7 +36,7 @@ sub unlockDeadBuilds { } if ($unlock) { print "build ", $build->id, " pid $pid died, unlocking\n"; - $build->update({ busy => 0, locker => ""}); + $build->update({ busy => 0, locker => "" }); $build->buildsteps->search({ busy => 1 })->update({ busy => 0, status => 4, stoptime => time }); } } @@ -174,7 +174,6 @@ sub checkBuilds { { busy => 1 , locker => $$ , logfile => $logfile - , starttime => time() }); push @buildsStarted, $build; next j; @@ -184,6 +183,10 @@ sub checkBuilds { last; # nothing found, give up on this system type } } + + $lastTime = time(); + + $_->update({ starttime => time() }) foreach @buildsStarted; }); # Actually start the builds we just selected. We need to do this @@ -208,9 +211,7 @@ sub checkBuilds { if ($@) { warn $@; txn_do($db, sub { - $build->busy(0); - $build->locker($$); - $build->update; + $build->update({ busy => 0, locker => $$ }); }); } } @@ -230,8 +231,6 @@ while (1) { unlockDeadBuilds; - $lastTime = time(); - checkBuilds; }; warn $@ if $@;