summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2009-06-19 04:08:38 +0200
committerbbaetz%acm.org <>2009-06-19 04:08:38 +0200
commit4c3c583a411a59ae42df2652c8122fcfd5364c52 (patch)
tree646cd39f43415ff947419bb60927aefee5c2a2c8 /Bugzilla
parent4e81c961a867a267570d2ab3b4b35117bcc8914b (diff)
downloadbugzilla-4c3c583a411a59ae42df2652c8122fcfd5364c52.tar.gz
bugzilla-4c3c583a411a59ae42df2652c8122fcfd5364c52.tar.xz
Bug 499121 - Cache user objects for Bug::GetComments
r/a=mkanat
Diffstat (limited to 'Bugzilla')
-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;