forked from lix-project/hydra
clear-queue-non-current: Work around PostgreSQL query optimizer stupidity
This commit is contained in:
parent
62809f484f
commit
6572869596
|
@ -35,8 +35,7 @@ sub machines : Chained('admin') PathPart('machines') Args(0) {
|
||||||
sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
|
sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
my $builds = $c->model('DB::Builds')->search(
|
my $builds = $c->model('DB::Builds')->search(
|
||||||
{ finished => 0, busy => 0
|
{ id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0 and busy = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by project, jobset)))" }
|
||||||
, id => { -not_in => \ "select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by project, jobset)" }
|
|
||||||
});
|
});
|
||||||
my $n = cancelBuilds($c->model('DB')->schema, $builds);
|
my $n = cancelBuilds($c->model('DB')->schema, $builds);
|
||||||
$c->flash->{successMsg} = "$n builds have been cancelled.";
|
$c->flash->{successMsg} = "$n builds have been cancelled.";
|
||||||
|
|
Loading…
Reference in a new issue