[open-ils-commits] [GIT] Evergreen ILS branch rel_3_1 updated. 2431aacd734227b61487224986a0d52cbfd800d0

Evergreen Git git at git.evergreen-ils.org
Fri May 31 10:44:17 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_1 has been updated
       via  2431aacd734227b61487224986a0d52cbfd800d0 (commit)
      from  bee1f478878b7d06732da716932e52d2601a7ab3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2431aacd734227b61487224986a0d52cbfd800d0
Author: Jason Stephenson <jason at sigio.com>
Date:   Tue Aug 7 10:02:10 2018 -0400

    LP 115706: Avoid Internal Server Errors with Hold Count Retrieval
    
    It can happen that the query to get a record's hold count can run too
    long and timeout or fail for some other reason.  When this happens,
    the user sees an Internal Server Error.  The underlying cause is the
    following Perl error:
    
    Can't use an undefined value as an ARRAY reference at
    /usr/local/share/perl/5.22.1/OpenILS/Application/Circ/Holds.pm line
    4264.
    
    This commit rearranges the code around that line to avoid this
    particular undefined value reference error.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Cesar Velez <cesar.velez at equinoxinitiative.org>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index 613ee8d7c8..22c86b0c73 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -4270,8 +4270,17 @@ sub rec_hold_count {
         } if ($pld != $top_ou->id);
     }
 
+    # To avoid Internal Server Errors, we get an editor, then run the
+    # query and check the result.  If anything fails, we'll return 0.
+    my $result = 0;
+    if (my $e = new_editor()) {
+        my $query_result = $e->json_query($query);
+        if ($query_result && @{$query_result}) {
+            $result = $query_result->[0]->{count}
+        }
+    }
 
-    return new_editor()->json_query($query)->[0]->{count};
+    return $result;
 }
 
 # A helper function to calculate a hold's expiration time at a given

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list