summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2014-02-10 09:07:55 +0100
committerByron Jones <bjones@mozilla.com>2014-02-10 09:07:55 +0100
commite551a3c17b2207324761b91e02f03c7f84fbc6ea (patch)
tree2736e15969342698a7feb5dc4346227261992afa /Bugzilla
parent240db1a527f880948ab1d17f915e55c986ffc716 (diff)
downloadbugzilla-e551a3c17b2207324761b91e02f03c7f84fbc6ea.tar.gz
bugzilla-e551a3c17b2207324761b91e02f03c7f84fbc6ea.tar.xz
Bug 961789: large dependency trees with lots of resolved bugs are very slow to load
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm23
1 files changed, 15 insertions, 8 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 1ba34f0a0..c3c9a2a2c 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -3855,17 +3855,24 @@ sub editable_bug_fields {
# Join with bug_status and bugs tables to show bugs with open statuses first,
# and then the others
sub EmitDependList {
- my ($myfield, $targetfield, $bug_id) = (@_);
+ my ($my_field, $target_field, $bug_id, $exclude_resolved) = @_;
+ my $cache = Bugzilla->request_cache->{bug_dependency_list} ||= {};
+
my $dbh = Bugzilla->dbh;
- my $list_ref = $dbh->selectcol_arrayref(
- "SELECT $targetfield
+ $exclude_resolved = $exclude_resolved ? 1 : 0;
+ my $is_open_clause = $exclude_resolved ? 'AND is_open = 1' : '';
+
+ $cache->{"${target_field}_sth_$exclude_resolved"} ||= $dbh->prepare(
+ "SELECT $target_field
FROM dependencies
- INNER JOIN bugs ON dependencies.$targetfield = bugs.bug_id
+ INNER JOIN bugs ON dependencies.$target_field = bugs.bug_id
INNER JOIN bug_status ON bugs.bug_status = bug_status.value
- WHERE $myfield = ?
- ORDER BY is_open DESC, $targetfield",
- undef, $bug_id);
- return $list_ref;
+ WHERE $my_field = ? $is_open_clause
+ ORDER BY is_open DESC, $target_field");
+
+ return $dbh->selectcol_arrayref(
+ $cache->{"${target_field}_sth_$exclude_resolved"},
+ undef, $bug_id);
}
# Creates a lot of bug objects in the same order as the input array.