Bugzilla – Attachment 70853 Details for
Bug 18725
process_message_queue.pl sends duplicate emails if message_queue is not writable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18725 - check for writability before sending each message
Bug-18725---check-for-writability-before-sending-e.patch (text/plain), 2.45 KB, created by
Kyle M Hall (khall)
on 2018-01-23 18:33:40 UTC
(
hide
)
Description:
Bug 18725 - check for writability before sending each message
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-01-23 18:33:40 UTC
Size:
2.45 KB
patch
obsolete
>From 7051a42151ac8a40576967c0ab762b32f78ee5a9 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Tue, 23 Jan 2018 13:31:03 -0500 >Subject: [PATCH] Bug 18725 - check for writability before sending each message > >This will mean that if we fill the disk in the middle of >processing the message queue we will not continue to send messages >even if the database was writable at the time of launch. >--- > C4/Letters.pm | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 42893f1..ec3b0aa 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -36,6 +36,7 @@ use Koha::DateUtils; > use Koha::SMS::Providers; > > use Koha::Email; >+use Koha::Notice::Messages; > use Koha::DateUtils qw( format_sqldatetime dt_from_string ); > use Koha::Patrons; > >@@ -1037,6 +1038,11 @@ sub SendQueuedMessages { > > my $unsent_messages = _get_unsent_messages( { limit => $params->{limit} } ); > MESSAGE: foreach my $message ( @$unsent_messages ) { >+ my $message_object = Koha::Notice::Messages->find( $message->{message_id} ); >+ $message_object->status('processing'); >+ # If this fails the database is unwritable and we won't manage to send a message that continues to be marked 'pending' >+ return unless $message_object->store(); >+ > # warn Data::Dumper->Dump( [ $message ], [ 'message' ] ); > warn sprintf( 'sending %s message to patron: %s', > $message->{'message_transport_type'}, >@@ -1053,11 +1059,11 @@ sub SendQueuedMessages { > my $sms_provider = Koha::SMS::Providers->find( $patron->sms_provider_id ); > unless ( $sms_provider ) { > warn sprintf( "Patron %s has no sms provider id set!", $message->{'borrowernumber'} ) if $params->{'verbose'} or $debug; >- _set_message_status( { message_id => $message->{'message_id'}, status => 'failed' } ); >+ # message has already been set to failed > next MESSAGE; > } > unless ( $patron->smsalertnumber ) { >- _set_message_status( { message_id => $message->{'message_id'}, status => 'failed' } ); >+ # message has already been set to failed, nothing to update > warn sprintf( "No smsalertnumber found for patron %s!", $message->{'borrowernumber'} ) if $params->{'verbose'} or $debug; > next MESSAGE; > } >-- >2.10.2
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 18725
:
64803
|
65625
|
68602
|
68603
|
70805
|
70826
|
70853
|
70876
|
73277
|
73278
|
73749
|
73750
|
73751
|
74143
|
74247