]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 897029: Preload bug permissions when calling Bug.get to improve performance
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 30 Jul 2013 09:15:15 +0000 (11:15 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 30 Jul 2013 09:15:15 +0000 (11:15 +0200)
r/a=sgreen

Bugzilla/WebService/Bug.pm

index 9c49068835e85d88c9ebcca74d66819858f1a574..c639084ef66094523e1a90809cabe11e149fadb6 100644 (file)
@@ -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}) {