forked from lix-project/hydra
hydra-queue-runner: Set the start time properly
This commit is contained in:
parent
52ce662710
commit
4cdf1a270d
|
@ -28,7 +28,7 @@ sub unlockDeadBuilds {
|
||||||
my $pid = $build->locker;
|
my $pid = $build->locker;
|
||||||
my $unlock = 0;
|
my $unlock = 0;
|
||||||
if ($pid == $$) {
|
if ($pid == $$) {
|
||||||
if (!defined $lastTime || $build->starttime < $lastTime - 180) {
|
if (!defined $lastTime || $build->starttime < $lastTime - 300) {
|
||||||
$unlock = 1;
|
$unlock = 1;
|
||||||
}
|
}
|
||||||
} elsif (kill(0, $pid) != 1) { # see if we can signal the process
|
} elsif (kill(0, $pid) != 1) { # see if we can signal the process
|
||||||
|
@ -36,7 +36,7 @@ sub unlockDeadBuilds {
|
||||||
}
|
}
|
||||||
if ($unlock) {
|
if ($unlock) {
|
||||||
print "build ", $build->id, " pid $pid died, unlocking\n";
|
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 });
|
$build->buildsteps->search({ busy => 1 })->update({ busy => 0, status => 4, stoptime => time });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,6 @@ sub checkBuilds {
|
||||||
{ busy => 1
|
{ busy => 1
|
||||||
, locker => $$
|
, locker => $$
|
||||||
, logfile => $logfile
|
, logfile => $logfile
|
||||||
, starttime => time()
|
|
||||||
});
|
});
|
||||||
push @buildsStarted, $build;
|
push @buildsStarted, $build;
|
||||||
next j;
|
next j;
|
||||||
|
@ -184,6 +183,10 @@ sub checkBuilds {
|
||||||
last; # nothing found, give up on this system type
|
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
|
# Actually start the builds we just selected. We need to do this
|
||||||
|
@ -208,9 +211,7 @@ sub checkBuilds {
|
||||||
if ($@) {
|
if ($@) {
|
||||||
warn $@;
|
warn $@;
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
$build->busy(0);
|
$build->update({ busy => 0, locker => $$ });
|
||||||
$build->locker($$);
|
|
||||||
$build->update;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,8 +231,6 @@ while (1) {
|
||||||
|
|
||||||
unlockDeadBuilds;
|
unlockDeadBuilds;
|
||||||
|
|
||||||
$lastTime = time();
|
|
||||||
|
|
||||||
checkBuilds;
|
checkBuilds;
|
||||||
};
|
};
|
||||||
warn $@ if $@;
|
warn $@ if $@;
|
||||||
|
|
Loading…
Reference in a new issue