Bug 32013: Autorenewal batch indexing
authorMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Tue, 6 Dec 2022 10:39:14 +0000 (10:39 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 12 Apr 2023 12:26:56 +0000 (09:26 -0300)
commit0fe026c6fa46135238f91826778bcbffcb13567b
treeaee8b0d5391844e48b284591d9f488214002f4b5
parent04f172d3442efc9d1bdbd06df8df6d741a617974
Bug 32013: Autorenewal batch indexing

The automatic_renewals.pl cron script currently loops through items for automatic renewal and calls the indexer for each one individually. skip_record_index has now been added as a parameter to the AddRenewal function to skip the indexing process. The item numbers are now added to an array and then the indexer is called once from within automatic_renewals.pl and passed the array to queue one indexing job instead of multiple jobs.

Test plan:
1) AddRenewal uses Koha::Items->store() to trigger the indexing process. Run prove -vv t/db_dependent/Koha/SearchEngine/Indexer.t and check tests 5,6,29,30. These tests prove whether passing skip_record_index to store() triggers or skips the indexing process. All four tests should pass to show that skip_index_records can prevent the indexing being triggered.
2) Add multiple renewals that are able to be autorenewed and run the automatic_renewals.pl script. There should be multiple items queued in zebraqueue.
3) Apply patch and try again
4) There should now only be one job queued in zebraqueue

Mentored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Circulation.pm
misc/cronjobs/automatic_renewals.pl