From fa1486fb4ecd71bdf45b21b74b67b3bf65e89450 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 19 Jun 2013 22:59:28 +0800 Subject: Bug 884817: move loading of comments into Bugzilla::Bug::preload() --- Bugzilla/Bug.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index bae5971ba..3805a51c8 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -512,6 +512,13 @@ sub preload { # If we don't do this, can_see_bug will do one call per bug in # the dependency lists, during get_bug_link in Bugzilla::Template. $user->visible_bugs(\@all_dep_ids); + + # We preload comments here in order to allow us to compare the time it + # takes to load comments from the database with the template rendering + # time. + foreach my $bug (@$bugs) { + $bug->comments(); + } } sub possible_duplicates { @@ -3436,6 +3443,8 @@ sub comments { } Bugzilla::Comment->preload($self->{'comments'}); } + return unless defined wantarray; + my @comments = @{ $self->{'comments'} }; my $order = $params->{order} -- cgit v1.2.3-24-g4f1b