Koha-clms/C4
Jonathan Druart 1d2313ec34 Bug 15854: Use a READ and WRITE LOCK on message_queue
To make sure we will not never get a race conditions for these kinds of
notices, we need to add a LOCK on the message_queue table.

This does not smell the best way to do that, but I faced deadlock issues
when I tried to use "UPDATE FOR"

https://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html
https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html
https://dev.mysql.com/doc/refman/5.7/en/commit.html

To test this patch, or another solution, you need to apply manually this
change:

         my $message = C4::Message->find_last_message($borrower, $type, $mtt);
         unless ( $message ) {
+            sleep(1);
             C4::Message->enqueue($letter, $borrower, $mtt);
         } else {

And repeat the test plan from first patch.
Do not forget to truncate the message_queue table.

Followed test plans, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit be156d9ad9)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-04-04 03:45:54 +12:00
..
AuthoritiesMarc Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Barcodes Bug 16635: [QA Follow-up] Eliminate some global package vars 2016-06-15 09:07:46 +02:00
Bookseller Bug 10402 follow-up: choose contacts for claims 2014-08-26 11:45:59 -03:00
ClassSortRoutine Bug 16011: $VERSION - Remove use vars qw(); 2016-03-24 17:20:39 +00:00
Creators Bug 18044: Label Batches not displaying 2017-02-16 07:23:50 +13:00
External Bug 16636: [QA Follow-up] Make BakerTaylor plack safe 2016-06-15 09:08:11 +02:00
Form Bug 16259: Replace CGI->param with CGI->multi_param in list context - part 2 2016-05-16 17:28:06 +00:00
Heading Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
ILSDI Bug 16864: Silence warnings in t/db_dependent/ILSDI_Services.t 2016-08-05 09:01:39 +02:00
Installer Bug 18018 - WWW:CSRF is missing in PerlDependencies.pm 2017-02-28 11:38:34 +13:00
Labels Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Linker Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Members Bug 16443: Make C4::Members::Statistics plack safe 2016-06-15 08:17:23 +02:00
OAI Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Output Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Patroncards Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Reports Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
SIP Bug 15006: [QA Follow-up] Only handle login requests in raw_transport 2016-08-01 11:54:02 +02:00
Search Bug 17323: Column search_history.time cannot be null 2016-12-31 15:19:46 +13:00
Serials Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Utils Bug 18094: Only search in searchable patron attributes if searching in standard fields 2017-04-04 03:44:52 +12:00
Accounts.pm Bug 15397 - Pay selected does not works as expected 2016-08-05 07:46:32 +02:00
Acquisition.pm Bug 16971: Missing dependency for HTML::Entities 2016-08-05 08:53:42 +02:00
Auth.pm Bug 18275: Do not rely on CGI param userid to log a user in if auth is not required 2017-03-18 02:24:06 +13:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-08 16:43:22 +02:00
Auth_with_cas.pm Bug 17481: Fix incorrect merge of bug 11048 (logout redirection for CAS authentication) 2016-12-12 14:54:08 +13:00
Auth_with_ldap.pm Bug 17775 - Add new user with LDAP not works under Plack 2017-02-22 22:12:11 +13:00
Auth_with_shibboleth.pm Bug 16818: External auth redirect broken under Plack 2016-08-05 08:51:45 +02:00
AuthoritiesMarc.pm Bug 17913: [16.11.x] followup 2017-02-24 10:12:30 +13:00
BackgroundJob.pm Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Barcodes.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Biblio.pm Bug 17372: Standardize Elasticsearch paths 2016-10-22 13:56:11 +02:00
Bookseller.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Boolean.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Branch.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Breeding.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Budgets.pm Bug 15009: QA follow-up 2016-04-29 13:00:21 +00:00
Calendar.pm Bug 15333: Use Koha::Cache to cache exception_holidays instead of a package variable 2016-05-25 22:18:27 +00:00
Category.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Charset.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Circulation.pm Bug 15854: Use a READ and WRITE LOCK on message_queue 2017-04-04 03:45:54 +12:00
ClassSortRoutine.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
ClassSource.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Context.pm Bug 16813: Allow empty string for OPACBaseURL 2016-08-01 13:31:21 +02:00
Contract.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
CourseReserves.pm Bug 16011: $VERSION - remove use vars $VERSION 2016-03-24 17:20:26 +00:00
Creators.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Csv.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Debug.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
HTML5Media.pm Bug 17231 - (QA Followup) 2016-09-08 22:21:35 +02:00
Heading.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
HoldsQueue.pm Bug 14514 - LocalHoldsPriority and the HoldsQueue conflict with each other 2016-10-22 14:32:21 +02:00
Images.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
ImportBatch.pm Bug 6852: Staged import reports wrong success for items 2016-09-13 09:49:40 +02:00
ImportExportFramework.pm Bug 17389: Clear logs 2016-10-22 14:37:09 +02:00
InstallAuth.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Installer.pm Bug 17234: Need to separate KEY and FOREIGN KEY checks 2017-01-25 13:19:12 +13:00
ItemCirculationAlertPreference.pm Bug 14828: Use Koha::ItemType[s] everywhere C4::ItemType was used 2016-01-27 20:46:58 +00:00
Items.pm Bug 17512: Improve handling dates in C4::Items 2017-02-23 09:36:21 +13:00
Koha.pm Bug 16716: Replaced wrong GROUP BY with DISTINCT 2016-08-01 13:31:23 +02:00
Labels.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Languages.pm Bug 16770: Remove wrong caching of 3 subroutines in C4::Lancuages 2016-08-01 10:19:58 +02:00
Letters.pm Bug 17903: Fix possible SQL injection in serial claims 2017-01-31 11:26:57 +13:00
Linker.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Log.pm Bug 16436 [QA Followup] - Use debug instead of info 2016-08-05 07:50:00 +02:00
MarcModificationTemplates.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Matcher.pm Bug 12478: make things using SimpleSearch use the new version 2016-04-26 20:20:07 +00:00
Members.pm Bug 17782: deletedborrowers.updated_on should be set to current timestamp 2017-02-23 11:29:20 +13:00
Message.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
NewsChannels.pm Bug 16550: Can't set opac news expiration date to NULL, it reverts to today 2016-05-23 17:37:48 +00:00
Output.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Overdues.pm Bug 14390: [Follow-up] Only update FU record in UpdateFine 2016-09-08 20:30:12 +02:00
Patroncards.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Print.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Ratings.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Record.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Reports.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Reserves.pm Bug 18015 - On shelf holds allowed > "If all unavailable" ignores notforloan 2017-02-23 03:08:23 +13:00
Review.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Ris.pm Bug 16245: [QA Follow-up] Replace typeofrecord2 by biblevel 2016-10-22 15:14:49 +02:00
RotatingCollections.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
SMS.pm Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Scheduler.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Scrubber.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Search.pm Bug 15822: Fix 500 error when searching if items.onloan=0000-00-00 2017-01-03 14:22:10 +13:00
Serials.pm Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' 2017-02-23 10:26:48 +13:00
Service.pm Bug 11559: Supporting changes for Rancor 2015-10-27 12:16:05 -03:00
ShelfBrowser.pm Bug 16315 - OPAC Shelfbrowser doesn't display the full title 2016-05-05 18:28:16 +00:00
SocialData.pm Bug 9978: (followup) Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:43 -03:00
Stats.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Suggestions.pm Bug 16325: Do not return all suggestions if search for STATUS='' 2016-05-05 20:46:02 +00:00
TTParser.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
Tags.pm Bug 16637: Dependency for C4::Tags not listed 2016-06-15 09:09:11 +02:00
Templates.pm Bug 18010: Remove potential exposure from gettemplate 2017-04-04 03:45:23 +12:00
TmplToken.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
TmplTokenType.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
UsageStats.pm Bug 16167: Remove Authorised value images prefs 2016-04-29 13:59:58 +00:00
XISBN.pm Bug 12478: make things using SimpleSearch use the new version 2016-04-26 20:20:07 +00:00
XSLT.pm Bug 18089 - All XSLT testing singleBranchMode = 0 fails to show even if install has only 1 branch 2017-02-23 09:36:22 +13:00