Bug 34678: Allow new entries to overwrite hold_fill_targets
authorNick Clemens <nick@bywatersolutions.com>
Wed, 13 Sep 2023 17:03:32 +0000 (17:03 +0000)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Mon, 13 Nov 2023 15:22:14 +0000 (15:22 +0000)
commit55db32c6bd4180aa8f1802d08d685471e0fd23ca
treea38ae638ca2e0eb6e784f172db2357603180bca2
parent22c8353ffa0a53f757fd4527d0cdb2036002cd9e
Bug 34678: Allow new entries to overwrite hold_fill_targets

When using background jobs, there is a possibility of a race condition where two jobs will be updating the holds queue for the same biblio. We should try to minimize those cases (see bug 34596)

In the meantime though, we should prevent jobs possibly dying, and allow the most recent update to succeed.

There is a possibility two updates wil assign different items to the same reserve, and that a reserve could end up in the queue twice, however, whichever one is filled first will delete both entries. as filling the hold deletes by reserve id (see bug 24359)

This patch adds a transaction to delete and then inset the new row

To test:
1 - prove -v t/db_dependent/Reserves.t
2 - It fails
3 - Apply patch
4 - t/db_dependent/Reserves.t
5 - It succeeds!

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit bbeab36789d8dd020bc5395d76c54cc2910caf49)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a65964c35b2d38ec7bcd87182e00ae4567aa0ae4)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
C4/HoldsQueue.pm