Bugzilla – Attachment 170043 Details for
Bug 37552
Automatic renewals cronjob can die when an item scheduled for renewal is checked in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37552: Wrap auto renewal attempt in eval to ensure script does not die
Bug-37552-Wrap-auto-renewal-attempt-in-eval-to-ens.patch (text/plain), 2.25 KB, created by
CJ Lynce
on 2024-08-03 16:29:18 UTC
(
hide
)
Description:
Bug 37552: Wrap auto renewal attempt in eval to ensure script does not die
Filename:
MIME Type:
Creator:
CJ Lynce
Created:
2024-08-03 16:29:18 UTC
Size:
2.25 KB
patch
obsolete
>From 0f7d1aae4fad2392323ec4aa5169376b87628544 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 1 Aug 2024 21:48:10 +0000 >Subject: [PATCH] Bug 37552: Wrap auto renewal attempt in eval to ensure script > does not die > >When libraries have a lot of checkouts, or an AMH, checkins can happen while the cron is running. > >This patch simply adds an eval around the auto renewal attempt in case of early check in or other errors. > >You can verify cron completed by enabling cronjob log in system preferences and checking the action logs > >To test: >1 - Add 'sleep(10);' to automatic_renewals.pl >2 - Set circulation rules to enable automatic renewals >3 - Issue an item to a patron >4 - perl misc/cronjobs/automatic_renewals.pl -v >5 - Confirm item would not be renewed >6 - perl misc/cronjobs/automatic_renewals.pl -v -c >7 - Quickly check in the item >8 - The cronjob dies > DBIx::Class::Row::update(): Can't update Koha::Schema::Result::Issue=HASH(0x586e1a674fb0): row not found at /kohadevbox/koha/Koha/Object.pm line 172 >9 - Apply patch >10 - Checkout the item again >11 - perl misc/cronjobs/automatic_renewals.pl -v -c >12 - Quickly checkin the item >13 - You get a warning, but the cron completes > >Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org> >--- > misc/cronjobs/automatic_renewals.pl | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index 013fc12b60..fd1370d676 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -213,7 +213,15 @@ sub _ProcessRenewals { > $wants_digest = 0; > } > >- my ( $success, $error, $updated ) = $auto_renew->attempt_auto_renew( { confirm => $confirm } ); >+ my ( $success, $error, $updated ); >+ eval { >+ ( $success, $error, $updated ) = $auto_renew->attempt_auto_renew( { confirm => $confirm } ); >+ }; >+ if( $@ ){ >+ print "An error was encounter in processing auto renewal for issue id: " . $auto_renew->issue_id ."\n"; >+ print "$@ \n"; >+ next; >+ } > if ($success) { > if ($verbose) { > say sprintf "Issue id: %s for borrower: %s and item: %s %s be renewed.", >-- >2.39.2
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 37552
:
169966
|
170043
|
170320
|
171199