Bugzilla – Attachment 127611 Details for
Bug 29474
Automatic renewals cronjob is slow on systems with large numbers of reserves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29474: Return too_soon before checking renewals
Bug-29474-Return-toosoon-before-checking-renewals.patch (text/plain), 2.49 KB, created by
Nick Clemens
on 2021-11-13 18:50:50 UTC
(
hide
)
Description:
Bug 29474: Return too_soon before checking renewals
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2021-11-13 18:50:50 UTC
Size:
2.49 KB
patch
obsolete
>From 09e68ac63da801d4b0f22e0dcbbadf83ccee0b6f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Sat, 13 Nov 2021 14:43:36 +0000 >Subject: [PATCH] Bug 29474: Return too_soon before checking renewals > >This patch allows us to avoid checking reserves when the issue is >too_soon and we are running the cron > >Code is covered by existing tests > >To test: >1 - prove -v t/db_dependent/Circulation.t >--- > C4/Circulation.pm | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index c2edf81f94..4cef8f9675 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2753,7 +2753,7 @@ sub CanBookBeRenewed { > > my $patron = $issue->patron or return; > >- # override_limit will override anything else except on_reserve >+ # override_limit will override anything else except on_reserve or too_soon > unless ( $override_limit ){ > my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ); > my $issuing_rule = Koha::CirculationRules->get_effective_rules( >@@ -2800,6 +2800,10 @@ sub CanBookBeRenewed { > return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; > } > >+ return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon' && $cron; >+ # cron wants 'too_soon' over 'on_reserve' for performance and to avoid >+ # extra notices being sent >+ > my ( $resfound, $resrec, $possible_reserves ) = C4::Reserves::CheckReserves($itemnumber); > > # If next hold is non priority, then check if any hold with priority (non_priority = 0) exists for the same biblionumber. >@@ -2858,13 +2862,9 @@ sub CanBookBeRenewed { > } > } > } >- if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve' >- return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; >- return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >- } else { # For other purposes we want 'on_reserve' before 'too_soon' >- return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >- return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; >- } >+ >+ return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >+ return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; > > return ( 0, "auto_renew" ) if $auto_renew eq "ok" && !$override_limit; # 0 if auto-renewal should not succeed > >-- >2.20.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 29474
:
127610
|
127611
|
127612
|
127613
|
127614
|
127615
|
127616
|
127617
|
127632
|
127633
|
127634
|
127635
|
127658
|
127903
|
127904
|
127905
|
127906
|
127907
|
127949
|
127950
|
127951
|
127952
|
127953
|
128554
|
128555
|
128556