[Rt-commit] r3892 - in rt/branches/3.4-RELEASE: . lib/RT/Action

robert at bestpractical.com robert at bestpractical.com
Wed Sep 28 12:16:04 EDT 2005


Author: robert
Date: Wed Sep 28 12:16:03 2005
New Revision: 3892

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/Action/SendEmail.pm
Log:
 r3945 at bear:  rspier | 2005-09-28 09:15:08 -0700
 Performance Improvement when Sending Email using sendmailpipe -
 
 MIME::Entity would bog down in certain cases because of it's use of IO::Scalar during stringification.  MIME::Entity will be switching to IO::ScalarArray, which will help... but RT was causing it to store into a temporary string anyway, which was silly.
 
 This change has MIME::Entity write directly to the pipe, which is a lot more efficient.  Seems to cut out ~33% of user time.  (Because we don't need to have a temporary IO::Scalar thingy around.)  Also will reduce peak memory usage.
 


Modified: rt/branches/3.4-RELEASE/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Action/SendEmail.pm	Wed Sep 28 12:16:03 2005
@@ -253,9 +253,9 @@
 
     if ( $RT::MailCommand eq 'sendmailpipe' ) {
         eval {
-            open( MAIL, "|$RT::SendmailPath $RT::SendmailArguments" ) || die $!;
-            print MAIL $MIMEObj->as_string;
-            close(MAIL);
+            open( my $mail, "|$RT::SendmailPath $RT::SendmailArguments" ) || die $!;
+            $MIMEObj->print($mail);
+            close($mail);
         };
         if ($@) {
             $RT::Logger->crit( $msgid . "Could not send mail. -" . $@ );


More information about the Rt-commit mailing list