LP#1624443 - TPAC 500 error after adding duplicate title to Temp List
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Tue, 8 Aug 2017 20:13:15 +0000 (16:13 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 17 Aug 2017 15:30:53 +0000 (11:30 -0400)
Credit to gmcharlt, prevents the my list (temporary list) page from
crashing when a user has added a title to the list more than once.
This can happen if they add a title then login, then redo search and
add same title. Per Galen, it looks like an issue with
OpenSRF::MultiSession parallel record retrieval causing some kind of
race condition when there are duplicate entries in the list.

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm

index 199ff7a..eb268dc 100644 (file)
@@ -3,6 +3,7 @@ use strict; use warnings;
 use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_INTERNAL_SERVER_ERROR REDIRECT HTTP_BAD_REQUEST);
 use File::Spec;
 use Time::HiRes qw/time sleep/;
+use List::MoreUtils qw/uniq/;
 use OpenSRF::Utils::Cache;
 use OpenSRF::Utils::Logger qw/$logger/;
 use OpenILS::Utils::CStoreEditor qw/:funcs/;
@@ -420,7 +421,7 @@ sub get_records_and_facets {
     $self->timelog("get_records_and_facets(): about to call ".
         "$unapi_type via json_query (rec_ids has " . scalar(@$rec_ids));
 
-    my @loop_recs = @$rec_ids;
+    my @loop_recs = uniq @$rec_ids;
     my %rec_timeout;
 
     while (my $bid = shift @loop_recs) {