[Bug 42297] New: Fines.pl run takes a long time to run
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42297 Bug ID: 42297 Summary: Fines.pl run takes a long time to run Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Fines and fees Assignee: koha-bugs@lists.koha-community.org Reporter: lmstrand@gmail.com QA Contact: testopia@bugs.koha-community.org We noticed a drastic increase in processing time in fines.pl run after switching from 24.05 to 25.05. Running it now takes approximately 4 times as long to finish. We are missing some indexes for recently added fields, one mentioned in https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22421. We also have N+1 issues in the way the script works. The fines.pl script loops through overdue items and fetches patron and checkout data one at a time which increases . for my $overdue ( @{$overdues} ) { my $patron = Koha::Patrons->find( $overdue->{borrowernumber} ); # Query 1 per iteration if ($verify_issue) { my $issue = Koha::Checkouts->find( { issue_id => $overdue->{issue_id} } ); # Query 2 per iteration } } we could: 1. Load all patrons in a single query (instead of N queries) 2. Same for checkouts (1 query instead of N) The N+1 issue was reported by AI and gave me some suggestions but I'm not willing to follow in it's footsteps to produce a patch. Also the idea introduced in https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16528 about parallel processing sounds nice to speed up the processing of fines. We might wanna take a look at https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24651 Add --maxdays option to the `fines.pl` cronjob to reduce the chance of re-processing very old, already capped, fines for increasing performance too. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org