Skip to content

Commit

Permalink
[backend] run linking of product trees in background
Browse files Browse the repository at this point in the history
of bs_repserver when running a binary copy (aka package release).
This avoids timeout errors via the api.
  • Loading branch information
adrianschroeter committed Jun 5, 2014
1 parent 3078d66 commit 4148674
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/backend/bs_repserver
Expand Up @@ -2004,6 +2004,7 @@ sub copybuild {
my $dir = "$jobsdir/$arch/$job:dir";
my $odir = "$reporoot/$oprojid/$orepoid/$arch/$opackid";
mkdir_p($dir);
my $delayed_linking;
my $needsign;
for my $bin (grep {$_ ne 'status' && $_ ne 'reason' && $_ ne 'history' && !/^\./} ls($odir)) {
if ($bin eq "updateinfo.xml" && $cgi->{'setupdateinfoid'}) {
Expand All @@ -2025,12 +2026,25 @@ sub copybuild {
$nbin =~ s/-([^-.]+).([^.]*.rpm)$/$setrelease.$2/; # rpms
}
if (-d "$odir/$bin") {
BSUtil::linktree("$odir/$bin", "$dir/$nbin");
$delayed_linking->{"$odir/$bin"} = "$dir/$nbin";
} else {
link("$odir/$bin", "$dir/$nbin") || die("link $odir/$bin $dir/$nbin: $!\n");
}
}
}

# we run the linking of directory tries in background, since it can take a long time
# otherwise we do it inline
my $pid;
$pid = xfork() if $delayed_linking;
return $BSStdServer::return_ok if ($pid);

# now run the delayed tree linking
for (keys %$delayed_linking) {
BSUtil::linktree($_, $delayed_linking->{$_});
}

# and emit signals to signer and scheduler
my $info = {
'project' => $projid,
'repository' => $repoid,
Expand Down

0 comments on commit 4148674

Please sign in to comment.