From 4c3c583a411a59ae42df2652c8122fcfd5364c52 Mon Sep 17 00:00:00 2001 From: "bbaetz%acm.org" <> Date: Fri, 19 Jun 2009 02:08:38 +0000 Subject: Bug 499121 - Cache user objects for Bug::GetComments r/a=mkanat --- Bugzilla/Bug.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f1fc9c424..b66ace54f 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3043,9 +3043,13 @@ sub GetComments { my $sth = $dbh->prepare($query); $sth->execute(@args); + # Cache the users we look up + my %users; + while (my $comment_ref = $sth->fetchrow_hashref()) { my %comment = %$comment_ref; - $comment{'author'} = new Bugzilla::User($comment{'userid'}); + $users{$comment{'userid'}} ||= new Bugzilla::User($comment{'userid'}); + $comment{'author'} = $users{$comment{'userid'}}; # If raw data is requested, do not format 'special' comments. $comment{'body'} = format_comment(\%comment) unless $raw; -- cgit v1.2.3-24-g4f1b