Don't set Expires header for logs of unfinished builds/steps

This commit is contained in:
Eelco Dolstra 2015-08-12 12:22:14 +02:00
parent 576dc0c120
commit 2e3899ed27
2 changed files with 8 additions and 4 deletions

View file

@ -119,18 +119,21 @@ sub view_nixlog : Chained('buildChain') PathPart('nixlog') {
$c->stash->{step} = $step;
showLog($c, $mode, $step->drvpath, map { $_->path } $step->buildstepoutputs->all);
showLog($c, $mode, $step->busy == 0, $step->drvpath,
map { $_->path } $step->buildstepoutputs->all);
}
sub view_log : Chained('buildChain') PathPart('log') {
my ($self, $c, $mode) = @_;
showLog($c, $mode, $c->stash->{build}->drvpath, map { $_->path } $c->stash->{build}->buildoutputs->all);
showLog($c, $mode, $c->stash->{build}->finished,
$c->stash->{build}->drvpath,
map { $_->path } $c->stash->{build}->buildoutputs->all);
}
sub showLog {
my ($c, $mode, $drvPath, @outPaths) = @_;
my ($c, $mode, $finished, $drvPath, @outPaths) = @_;
my $logPath = findLog($c, $drvPath, @outPaths);
@ -154,6 +157,7 @@ sub showLog {
elsif ($mode eq "raw") {
$c->stash->{logPath} = $logPath;
$c->stash->{finished} = $finished;
$c->forward('Hydra::View::NixLog');
return;
}

View file

@ -20,7 +20,7 @@ sub process {
}
binmode($fh);
setCacheHeaders($c, 365 * 24 * 60 * 60);
setCacheHeaders($c, 365 * 24 * 60 * 60) if $c->stash->{finished};
$c->response->body($fh);