From c74993e8cb7d8f95f8942e5af57e1fb4b7e1e982 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 18 Jun 2013 15:11:18 +0800 Subject: Bug 884177: add simple instrumentation to process_bug.cgi --- Bugzilla/Bug.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 75d388faa..bae5971ba 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1223,15 +1223,15 @@ sub send_changes { changer => $user, ); - _send_bugmail({ id => $self->id, type => 'bug', forced => \%forced }, - $vars); + my $recipient_count = _send_bugmail( + { id => $self->id, type => 'bug', forced => \%forced }, $vars); # If the bug was marked as a duplicate, we need to notify users on the # other bug of any changes to that bug. my $new_dup_id = $changes->{'dup_id'} ? $changes->{'dup_id'}->[1] : undef; if ($new_dup_id) { - _send_bugmail({ forced => { changer => $user }, type => "dupe", - id => $new_dup_id }, $vars); + $recipient_count += _send_bugmail( + { forced => { changer => $user }, type => "dupe", id => $new_dup_id }, $vars); } # If there were changes in dependencies, we need to notify those @@ -1250,7 +1250,7 @@ sub send_changes { foreach my $id (@{ $self->blocked }) { $params->{id} = $id; - _send_bugmail($params, $vars); + $recipient_count += _send_bugmail($params, $vars); } } } @@ -1268,15 +1268,17 @@ sub send_changes { delete $changed_deps{''}; foreach my $id (sort { $a <=> $b } (keys %changed_deps)) { - _send_bugmail({ forced => { changer => $user }, type => "dep", - id => $id }, $vars); + $recipient_count += _send_bugmail( + { forced => { changer => $user }, type => "dep", id => $id }, $vars); } # Sending emails for the referenced bugs. foreach my $ref_bug_id (uniq @{ $self->{see_also_changes} || [] }) { - _send_bugmail({ forced => { changer => $user }, - id => $ref_bug_id }, $vars); + $recipient_count += _send_bugmail( + { forced => { changer => $user }, id => $ref_bug_id }, $vars); } + + return $recipient_count; } sub _send_bugmail { @@ -1284,7 +1286,7 @@ sub _send_bugmail { require Bugzilla::BugMail; - my $results = + my $results = Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params); if (Bugzilla->usage_mode == USAGE_MODE_BROWSER) { @@ -1295,6 +1297,8 @@ sub _send_bugmail { || ThrowTemplateError($template->error()); $vars->{'header_done'} = 1; } + + return scalar @{ $results->{sent} }; } ##################################################################### -- cgit v1.2.3-24-g4f1b