From 6738e57abc247a6dbb238d6bb01c866e60cb6f29 Mon Sep 17 00:00:00 2001 From: "bzrmirror%bugzilla.org" Date: Tue, 13 Aug 2013 18:14:02 +0000 Subject: [PATCH] Bug 897029: Preload bug permissions when calling Bug.get to improve performance r/a=sgreen git-svn-id: svn://10.0.0.236/trunk@264931 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index 2b0c32be04c..80a2718a7c2 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -8673 \ No newline at end of file +8674 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm index 9c49068835e..c639084ef66 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm @@ -323,6 +323,12 @@ sub get { my @bugs; my @faults; + + # Cache permissions for bugs. This highly reduces the number of calls to the DB. + # visible_bugs() is only able to handle bug IDs, so we have to skip aliases. + my @int = grep { $_ =~ /^\d+$/ } @$ids; + Bugzilla->user->visible_bugs(\@int); + foreach my $bug_id (@$ids) { my $bug; if ($params->{permissive}) {