aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2009-06-19 02:08:41 +0000
committerbbaetz%acm.org <>2009-06-19 02:08:41 +0000
commitfca8b7c53704d504be7d11d4580f7403a62fadde (patch)
tree23091b7b7f0470d3444d69fb65a8e1729381c9de
parent496856 - correct patch (diff)
downloadbugzilla-fca8b7c53704d504be7d11d4580f7403a62fadde.tar.gz
bugzilla-fca8b7c53704d504be7d11d4580f7403a62fadde.tar.bz2
bugzilla-fca8b7c53704d504be7d11d4580f7403a62fadde.zip
Bug 499121 - Cache user objects for Bug::GetComments
r/a=mkanat
-rw-r--r--Bugzilla/Bug.pm6
1 files changed, 5 insertions, 1 deletions
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;