Bugzilla – Attachment 169966 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.20 KB, created by
Nick Clemens (kidclamp)
on 2024-08-01 21:54:06 UTC
(
hide
)
Description:
Bug 37552: Wrap auto renewal attempt in eval to ensure script does not die
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-08-01 21:54:06 UTC
Size:
2.20 KB
patch
obsolete
>From 4fbe5ddf91e0ca2ecfad09a83925044f9b67b76e 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 >--- > 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 013fc12b601..fd1370d6768 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