From 6940aa91a53371ba49528022954a9a349044ab63 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Thu, 1 Oct 2015 15:23:23 +0300 Subject: [PATCH] Bug 14932 - serials/serials-collection.pl-page is very slow. GetFullSubscription* checks permission for each serial! Currently we have subscriptions with 300+ serials received. It takes a lot of time to show serials-collection.pl (~20s). This is especially troublesome when receiving serials, since after receival we get redirected to that page. We no longer can receive daily serials in the allotted timeframe. This quick and dirty fix prevents checking the subscription editing for each serial, but instead checks it for the first serial only. This reduced page load time by ~18s TEST PLAN: 1. Receive ~300 serials (or just a bunch :) ) 2. Observe the gradual slowing of the receival action. AFTER THIS PATCH: 1. Receive ~300 serials more (or just a bunch) 2. Observe a significant performance improvement. Signed-off-by: Paul POULAIN Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- C4/Serials.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 179595f6a0..040fe61b7b 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -343,8 +343,9 @@ sub GetFullSubscription { my $sth = $dbh->prepare($query); $sth->execute($subscriptionid); my $subscriptions = $sth->fetchall_arrayref( {} ); + my $cannotedit = not can_edit_subscription( $subscriptions->[0] ) if ref($subscriptions) eq 'ARRAY'; for my $subscription ( @$subscriptions ) { - $subscription->{cannotedit} = not can_edit_subscription( $subscription ); + $subscription->{cannotedit} = $cannotedit; } return $subscriptions; } @@ -502,8 +503,9 @@ sub GetFullSubscriptionsFromBiblionumber { my $sth = $dbh->prepare($query); $sth->execute($biblionumber); my $subscriptions = $sth->fetchall_arrayref( {} ); + my $cannotedit = not can_edit_subscription( $subscriptions->[0] ) if ref($subscriptions) eq 'ARRAY'; for my $subscription ( @$subscriptions ) { - $subscription->{cannotedit} = not can_edit_subscription( $subscription ); + $subscription->{cannotedit} = $cannotedit; } return $subscriptions; } -- 2.39.5