Skip to content

Commit

Permalink
Merge pull request #2834 from lethliel/auto_retrigger_service
Browse files Browse the repository at this point in the history
[backend] retrigger service run after 10 minutes
  • Loading branch information
lethliel committed Mar 15, 2017
2 parents 5c68b4e + e77f9cc commit 71fbb90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/backend/bs_service
Expand Up @@ -173,21 +173,21 @@ sub run_source_update {
push @run, "$myworkdir/out";

mkdir("$myworkdir/out") || die("mkdir $myworkdir/out: $!\n");

BSUtil::printlog("Running command '@run'");
# call the service
if (! open(SERVICE, '-|')) {
open(STDERR, ">&STDOUT");
exec(@run);
die("$run[0]: $!\n");
}

# collect output
my $output = '';
while (<SERVICE>) {
$output .= $_;
}

BSUtil::printlog(" $name: $output") if $verbose;

if (close SERVICE) {
Expand All @@ -203,6 +203,7 @@ sub run_source_update {
# FAILURE, Create error file
$output =~ s/[\r\n\s]+$//s;
BSUtil::cleandir('.');
die("500 remote execution error in $name detected\n") if $? >> 8 == 3;
BSUtil::writestr('_service_error', undef, "service $name failed:\n$output\n");
$error = 1;
}
Expand Down
2 changes: 2 additions & 0 deletions src/backend/bs_servicedispatch
Expand Up @@ -177,6 +177,8 @@ sub runservice {
$error = $@ if $@;
} else {
$error ||= 'error';
die("Transient error for $projid/$packid: $error") if $error =~ /^5/;
die("RPC error for $projid/$packid: $error") if $error !~ /^\d/;
$error = "service daemon error:\n $error";
}
BSUtil::cleandir($odir);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/call-service-in-docker.sh
Expand Up @@ -166,7 +166,7 @@ if [ $? -eq 0 ]; then
else
printlog "$CMD_OUT"
echo "$CMD_OUT"
RETURN="2"
RETURN="3"
fi

if [[ $DEBUG_DOCKER ]];then
Expand Down

0 comments on commit 71fbb90

Please sign in to comment.