From: Frédéric Buclin Date: Tue, 30 Jul 2013 09:15:15 +0000 (+0200) Subject: Bug 897029: Preload bug permissions when calling Bug.get to improve performance X-Git-Tag: bugzilla-4.5.1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5fb55b45ed5ed9b51ab967ab4b1019085641294;p=thirdparty%2Fbugzilla.git Bug 897029: Preload bug permissions when calling Bug.get to improve performance r/a=sgreen --- diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 9c49068835..c639084ef6 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/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}) {