Bugzilla – Attachment 79912 Details for
Bug 15529
Process Message Queue may send duplicate emails if process is launched twice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15529 - Wrapping email sending up in the verbose flag
Bug-15529---Wrapping-email-sending-up-in-the-verbo.patch (text/plain), 3.29 KB, created by
Mark Tompsett
on 2018-10-04 00:02:09 UTC
(
hide
)
Description:
Bug 15529 - Wrapping email sending up in the verbose flag
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-10-04 00:02:09 UTC
Size:
3.29 KB
patch
obsolete
>From b8417cf19780c4c72ea62d539a11dda83cf0e907 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Sat, 29 Sep 2018 06:06:09 +0000 >Subject: [PATCH] Bug 15529 - Wrapping email sending up in the verbose flag > >Thus the cron email telling the administrator or support company that a second execution of the process_message_queue.pl cron whilst it is already running is only sent if it is wanted and verbose is set. > >Sponsored-By: New Zealand Parliamentary Library > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > misc/cronjobs/process_message_queue.pl | 47 ++++++++++++++++++++-------------- > 1 file changed, 28 insertions(+), 19 deletions(-) > >diff --git a/misc/cronjobs/process_message_queue.pl b/misc/cronjobs/process_message_queue.pl >index 0a6d8c98f0..b15b595854 100755 >--- a/misc/cronjobs/process_message_queue.pl >+++ b/misc/cronjobs/process_message_queue.pl >@@ -55,6 +55,12 @@ GetOptions( > 'v|verbose' => \$verbose, > 't|type' => \$type, > ); >+ >+sub usage { >+ pod2usage( -verbose => 2 ); >+ exit; >+} >+ > my $usage = << 'ENDUSAGE'; > > This script processes the message queue in the message_queue database >@@ -70,7 +76,7 @@ This script has the following parameters : > -l --limit: The maximum number of messages to process for this run > -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.) > -h --help: this message >- -v --verbose: provides verbose output to STDOUT >+ -v --verbose: provides verbose output to STDOUT, if verbose is set then emails will be sent upon duplicate execution of this cronjob > ENDUSAGE > > die $usage if $help; >@@ -87,24 +93,27 @@ open(FOO, ">> $instancemessagequeuefile") or die "Cannot write to $instancemessa > print "Getting the lock\n"; > unless (flock ( FOO, LOCK_EX|LOCK_NB )) { > >-print "$0 is already running. Exiting.\n"; >-#Send email to inform administrator another process_message_queue.pl cron was attempted to run whilst previous execution of the file is taking place. >-# Configure accordingly >-MIME::Lite->send( 'smtp', ''); >-my $email = MIME::Lite->new( >-To => ' ', >-From => ' ', >-Type => 'TEXT', >-Subject => 'process_message_queue.pl cron is already running', >-Data => 'process_message_queue.pl cron is already running', >-); >- >-$email->attach( >-Type => 'Text', >- Data => 'process_message_queue.pl cron is already running', >-); >-$email->send(); >-exit(1); >+ print "$0 is already running. Exiting.\n"; >+ #If verbose is set send email to inform administrator another process_message_queue.pl cron was attempted to run whilst previous execution of the file is taking place. >+ # Configure accordingly >+ >+ if ($verbose) { >+ MIME::Lite->send( 'smtp', ''); >+ my $email = MIME::Lite->new( >+ To => ' ', >+ From => ' ', >+ Type => 'TEXT', >+ Subject => 'process_message_queue.pl cron is already running', >+ Data => 'process_message_queue.pl cron is already running', >+ ); >+ >+ $email->attach( >+ Type => 'Text', >+ Data => 'process_message_queue.pl cron is already running', >+ ); >+ $email->send(); >+ exit(1); >+ } > } > > C4::Letters::SendQueuedMessages( { verbose => $verbose, username => $username, password => $password, method => $method } ); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15529
:
78205
|
78210
|
78211
|
78212
|
78582
|
78918
|
79649
|
79719
|
79726
|
79910
|
79911
| 79912 |
79913
|
80256