forked from lix-project/hydra
Use delete instead of delete_all
DBIC's delete_all method fetches all rows separately, which is slow.
This commit is contained in:
parent
f32077b5e8
commit
720c3892a3
|
@ -53,19 +53,11 @@ sub clearfailedcache : Chained('admin') PathPart('clear-failed-cache') Args(0) {
|
||||||
|
|
||||||
sub clearvcscache : Chained('admin') PathPart('clear-vcs-cache') Args(0) {
|
sub clearvcscache : Chained('admin') PathPart('clear-vcs-cache') Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
|
$c->model('DB::CachedPathInputs')->delete;
|
||||||
print STDERR "Clearing path cache\n";
|
$c->model('DB::CachedGitInputs')->delete;
|
||||||
$c->model('DB::CachedPathInputs')->delete_all;
|
$c->model('DB::CachedSubversionInputs')->delete;
|
||||||
|
$c->model('DB::CachedBazaarInputs')->delete;
|
||||||
print STDERR "Clearing git cache\n";
|
$c->flash->{successMsg} = "VCS caches have been cleared.";
|
||||||
$c->model('DB::CachedGitInputs')->delete_all;
|
|
||||||
|
|
||||||
print STDERR "Clearing subversion cache\n";
|
|
||||||
$c->model('DB::CachedSubversionInputs')->delete_all;
|
|
||||||
|
|
||||||
print STDERR "Clearing bazaar cache\n";
|
|
||||||
$c->model('DB::CachedBazaarInputs')->delete_all;
|
|
||||||
|
|
||||||
$c->res->redirect($c->request->referer // "/admin");
|
$c->res->redirect($c->request->referer // "/admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ sub jobset_DELETE {
|
||||||
requireProjectOwner($c, $c->stash->{project});
|
requireProjectOwner($c, $c->stash->{project});
|
||||||
|
|
||||||
txn_do($c->model('DB')->schema, sub {
|
txn_do($c->model('DB')->schema, sub {
|
||||||
$c->stash->{jobset}->jobsetevals->delete_all;
|
$c->stash->{jobset}->jobsetevals->delete;
|
||||||
$c->stash->{jobset}->builds->delete_all;
|
$c->stash->{jobset}->builds->delete;
|
||||||
$c->stash->{jobset}->delete;
|
$c->stash->{jobset}->delete;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,8 @@ sub project_DELETE {
|
||||||
requireProjectOwner($c, $c->stash->{project});
|
requireProjectOwner($c, $c->stash->{project});
|
||||||
|
|
||||||
txn_do($c->model('DB')->schema, sub {
|
txn_do($c->model('DB')->schema, sub {
|
||||||
$c->stash->{project}->jobsetevals->delete_all;
|
$c->stash->{project}->jobsetevals->delete;
|
||||||
$c->stash->{project}->builds->delete_all;
|
$c->stash->{project}->builds->delete;
|
||||||
$c->stash->{project}->delete;
|
$c->stash->{project}->delete;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ sub updateRelease {
|
||||||
, description => trim $c->request->params->{description}
|
, description => trim $c->request->params->{description}
|
||||||
});
|
});
|
||||||
|
|
||||||
$release->releasemembers->delete_all;
|
$release->releasemembers->delete;
|
||||||
foreach my $param (keys %{$c->request->params}) {
|
foreach my $param (keys %{$c->request->params}) {
|
||||||
next unless $param =~ /^member-(\d+)-description$/;
|
next unless $param =~ /^member-(\d+)-description$/;
|
||||||
my $buildId = $1;
|
my $buildId = $1;
|
||||||
|
|
|
@ -254,7 +254,7 @@ sub edit_POST {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAdmin($c)) {
|
if (isAdmin($c)) {
|
||||||
$user->userroles->delete_all;
|
$user->userroles->delete;
|
||||||
$user->userroles->create({ role => $_})
|
$user->userroles->create({ role => $_})
|
||||||
foreach paramToList($c, "roles");
|
foreach paramToList($c, "roles");
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ sub updateView {
|
||||||
{ name => $viewName
|
{ name => $viewName
|
||||||
, description => trim $c->request->params->{description} });
|
, description => trim $c->request->params->{description} });
|
||||||
|
|
||||||
$view->viewjobs->delete_all;
|
$view->viewjobs->delete;
|
||||||
|
|
||||||
foreach my $param (keys %{$c->request->params}) {
|
foreach my $param (keys %{$c->request->params}) {
|
||||||
next unless $param =~ /^job-(\d+)-name$/;
|
next unless $param =~ /^job-(\d+)-name$/;
|
||||||
|
|
|
@ -570,7 +570,7 @@ sub restartBuild {
|
||||||
, iscachedbuild => 0
|
, iscachedbuild => 0
|
||||||
});
|
});
|
||||||
|
|
||||||
$build->buildproducts->delete_all;
|
$build->buildproducts->delete;
|
||||||
|
|
||||||
# Reset the stats for the evals to which this build belongs.
|
# Reset the stats for the evals to which this build belongs.
|
||||||
# !!! Should do this in a trigger.
|
# !!! Should do this in a trigger.
|
||||||
|
|
|
@ -354,8 +354,8 @@ txn_do($db, sub {
|
||||||
die "build $buildId is already being built";
|
die "build $buildId is already being built";
|
||||||
}
|
}
|
||||||
$build->update({busy => 1, locker => $$});
|
$build->update({busy => 1, locker => $$});
|
||||||
$build->buildsteps->search({busy => 1})->delete_all;
|
$build->buildsteps->search({busy => 1})->delete;
|
||||||
$build->buildproducts->delete_all;
|
$build->buildproducts->delete;
|
||||||
});
|
});
|
||||||
|
|
||||||
die unless $build;
|
die unless $build;
|
||||||
|
|
Loading…
Reference in a new issue