From c5fb55b45ed5ed9b51ab967ab4b1019085641294 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 30 Jul 2013 11:15:15 +0200 Subject: Bug 897029: Preload bug permissions when calling Bug.get to improve performance r/a=sgreen --- Bugzilla/WebService/Bug.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 9c4906883..c639084ef 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}) { -- cgit v1.2.3-24-g4f1b