Bug 31342: Add execution locking to process_message_queue.pl
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 12 Aug 2022 09:50:59 +0000 (06:50 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 19 Sep 2022 18:13:52 +0000 (15:13 -0300)
commita80a96b93381a12740b8548b5d92a55bbec0b085
tree090e77999d0965aae9170cc91094af572b25f716
parentdca43b8313bc352729b1e30c9cf83af4315e9fde
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
Signed-off-by: Liz Rea <liz@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
misc/cronjobs/process_message_queue.pl