* Monitor for dead builds all the time.

This commit is contained in:
Eelco Dolstra 2008-11-28 11:00:55 +00:00
parent ba5e4be15e
commit 2156e406b4

View file

@ -11,8 +11,9 @@ my $db = Hydra::Schema->connect("dbi:SQLite:dbname=hydra.sqlite", "", "", {});
$db->storage->dbh->do("PRAGMA synchronous = OFF;"); $db->storage->dbh->do("PRAGMA synchronous = OFF;");
# Unlock jobs whose building process has died. sub unlockDeadJobs {
$db->txn_do(sub { # Unlock jobs whose building process has died.
$db->txn_do(sub {
my @jobs = $db->resultset('Builds')->search( my @jobs = $db->resultset('Builds')->search(
{finished => 0, busy => 1}, {join => 'schedulingInfo'}); {finished => 0, busy => 1}, {join => 'schedulingInfo'});
foreach my $job (@jobs) { foreach my $job (@jobs) {
@ -24,7 +25,8 @@ $db->txn_do(sub {
$job->schedulingInfo->update; $job->schedulingInfo->update;
} }
} }
}); });
}
sub checkJobs { sub checkJobs {
@ -112,6 +114,7 @@ sub checkJobs {
while (1) { while (1) {
eval { eval {
unlockDeadJobs;
checkJobs; checkJobs;
}; };
warn $@ if $@; warn $@ if $@;