Let Builds.timestamp refer to the time the build was added
Previously, for scheduled builds, "timestamp" contained the time the build was added to the queue, while for finished builds, it was the time the build finished. Now it's always the former.
This commit is contained in:
@ -90,7 +90,7 @@ sub latestbuilds : Chained('api') PathPart('latestbuilds') Args(0) {
|
||||
$filter->{job} = $job if !$job eq "";
|
||||
$filter->{system} = $system if !$system eq "";
|
||||
|
||||
my @latest = $c->model('DB::Builds')->search($filter, {rows => $nr, order_by => ["timestamp DESC"] });
|
||||
my @latest = $c->model('DB::Builds')->search($filter, {rows => $nr, order_by => ["id DESC"] });
|
||||
|
||||
my @list;
|
||||
push @list, buildToHash($_) foreach @latest;
|
||||
@ -142,7 +142,7 @@ sub queue : Chained('api') PathPart('queue') Args(0) {
|
||||
my $nr = $c->request->params->{nr};
|
||||
error($c, "Parameter not defined!") if !defined $nr;
|
||||
|
||||
my @builds = $c->model('DB::Builds')->search({finished => 0}, {rows => $nr, order_by => ["busy DESC", "priority DESC", "timestamp"]});
|
||||
my @builds = $c->model('DB::Builds')->search({finished => 0}, {rows => $nr, order_by => ["busy DESC", "priority DESC", "id"]});
|
||||
|
||||
my @list;
|
||||
push @list, buildToHash($_) foreach @builds;
|
||||
|
@ -34,7 +34,8 @@ sub machines : Chained('admin') PathPart('machines') Args(0) {
|
||||
|
||||
sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->model('DB::Builds')->search({finished => 0, iscurrent => 0, busy => 0})->update({ finished => 1, buildstatus => 4, timestamp => time});
|
||||
my $time = time();
|
||||
$c->model('DB::Builds')->search({finished => 0, iscurrent => 0, busy => 0})->update({ finished => 1, buildstatus => 4, starttime => $time, stoptime => $time });
|
||||
$c->res->redirect($c->request->referer // "/admin");
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ sub download : Chained('build') PathPart {
|
||||
notFound($c, "Path $path is a directory.") if -d $path;
|
||||
|
||||
$c->serve_static_file($path);
|
||||
$c->response->headers->last_modified($c->stash->{build}->timestamp);
|
||||
$c->response->headers->last_modified($c->stash->{build}->stoptime);
|
||||
}
|
||||
|
||||
|
||||
@ -423,9 +423,12 @@ sub cancel : Chained('build') PathPart Args(0) {
|
||||
# builds as well, but we would have to send a signal or
|
||||
# something to the build process.
|
||||
|
||||
my $time = time();
|
||||
$build->update(
|
||||
{ finished => 1, busy => 0, timestamp => time
|
||||
{ finished => 1, busy => 0
|
||||
, iscachedbuild => 0, buildstatus => 4 # = cancelled
|
||||
, starttime => $time
|
||||
, stoptime => $time
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -25,13 +25,13 @@ sub overview : Chained('job') PathPart('') Args(0) {
|
||||
|
||||
$c->stash->{lastBuilds} =
|
||||
[ $c->stash->{job}->builds->search({ finished => 1 },
|
||||
{ order_by => 'timestamp DESC', rows => 10, columns => [@buildListColumns] }) ];
|
||||
{ order_by => 'id DESC', rows => 10, columns => [@buildListColumns] }) ];
|
||||
|
||||
$c->stash->{queuedBuilds} = [
|
||||
$c->stash->{job}->builds->search(
|
||||
{ finished => 0 },
|
||||
{ join => ['project']
|
||||
, order_by => ["priority DESC", "timestamp"]
|
||||
, order_by => ["priority DESC", "id"]
|
||||
, '+select' => ['project.enabled']
|
||||
, '+as' => ['enabled']
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ sub queue :Local {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{template} = 'queue.tt';
|
||||
$c->stash->{queue} = [$c->model('DB::Builds')->search(
|
||||
{finished => 0}, { join => ['project'], order_by => ["priority DESC", "timestamp"], columns => [@buildListColumns], '+select' => ['project.enabled'], '+as' => ['enabled'] })];
|
||||
{finished => 0}, { join => ['project'], order_by => ["priority DESC", "id"], columns => [@buildListColumns], '+select' => ['project.enabled'], '+as' => ['enabled'] })];
|
||||
$c->stash->{flashMsg} //= $c->flash->{buildMsg};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user