Bugzilla – Attachment 139045 Details for
Bug 31342
process_message_queue can run over the top of itself causing double-up emails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31342: Add execution locking to process_message_queue.pl
Bug-31342-Add-execution-locking-to-processmessageq.patch (text/plain), 1.63 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-08-12 09:56:55 UTC
(
hide
)
Description:
Bug 31342: Add execution locking to process_message_queue.pl
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-08-12 09:56:55 UTC
Size:
1.63 KB
patch
obsolete
>From 4b9d8877145765f8f4380656d2a16b4c38506a5b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 12 Aug 2022 06:50:59 -0300 >Subject: [PATCH] Bug 31342: Add execution locking to process_message_queue.pl > >This patch makes the script use an execution lock as provided by >Koha::Script. Previous attempt got too complex and contentious, and >given we have a simple way to achieve the same thing, I decided to >submit an alternative approach. > >To test: >1. Apply this patch >2. Add the following content to misc/cronjobs/process_message_queue.pl > on line 83: > > sleep 100; > >3. Save the file >4. Have two terminals open >5. On the first one, run: > $ kshell > k$ misc/cronjobs/process_message_queue.pl >6. On the second one, run the same >=> SUCCESS: The second one dies telling it had to skip the run >7. Undo your changes: > $ git checkout misc/cronjobs/process_message_queue.pl >8. Sign off :-D > >Sponsored-by: ByWater Solutions >--- > misc/cronjobs/process_message_queue.pl | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > >diff --git a/misc/cronjobs/process_message_queue.pl b/misc/cronjobs/process_message_queue.pl >index d8918be607..b67b8530ad 100755 >--- a/misc/cronjobs/process_message_queue.pl >+++ b/misc/cronjobs/process_message_queue.pl >@@ -66,6 +66,19 @@ ENDUSAGE > > die $usage if $help; > >+my $script_handler = Koha::Script->new({ script => $0 }); >+ >+try { >+ $script_handler->lock_exec; >+} >+catch { >+ my $message = "Skipping execution of $0 ($_)"; >+ print STDERR "$message\n" >+ if $verbose; >+ cronlogaction( $message ); >+ exit; >+}; >+ > cronlogaction(); > > if ( C4::Context->config("enable_plugins") ) { >-- >2.34.1
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 31342
:
139045
|
139057
|
140733