[open-ils-commits] [GIT] Evergreen ILS branch master updated. 5708b03000eb649c0feda7d430b0096d1faebade

Evergreen Git git at git.evergreen-ils.org
Thu Sep 22 00:28:10 EDT 2011


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, master has been updated
       via  5708b03000eb649c0feda7d430b0096d1faebade (commit)
      from  e0d8dbf11299207399fd471afeca45cd1bb8346b (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 5708b03000eb649c0feda7d430b0096d1faebade
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Sep 16 11:49:08 2011 -0400

    Tpac: longer timeout for marc "expert" search
    
    Since MARC searches can take a while, raise the default timeout from
    1 minute to 2, with the option (at the API layer) of raising it to 5.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
index 2bc7062..ac8046b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -2161,7 +2161,7 @@ Presently, search uses the cache unconditionally.
 # FIXME: that example above isn't actually tested.
 # TODO: docache option?
 sub marc_search {
-	my( $self, $conn, $args, $limit, $offset ) = @_;
+	my( $self, $conn, $args, $limit, $offset, $timeout ) = @_;
 
 	my $method = 'open-ils.storage.biblio.full_rec.multi_search';
 	$method .= ".staff" if $self->api_name =~ /staff/;
@@ -2170,6 +2170,11 @@ sub marc_search {
     $limit  ||= 10;     # FIXME: what about $args->{limit} ?
     $offset ||=  0;     # FIXME: what about $args->{offset} ?
 
+    # allow caller to pass in a call timeout since MARC searches
+    # can take longer than the default 60-second timeout.  
+    # Default to 2 mins.  Arbitrarily cap at 5 mins.
+    $timeout = 120 if !$timeout or $timeout > 300;
+
 	my @search;
 	push( @search, ($_ => $$args{$_}) ) for (sort keys %$args);
 	my $ckey = $pfx . md5_hex($method . OpenSRF::Utils::JSON->perl2JSON(\@search));
@@ -2177,13 +2182,19 @@ sub marc_search {
 	my $recs = search_cache($ckey, $offset, $limit);
 
 	if(!$recs) {
-		$recs = $U->storagereq($method, %$args) || [];
-		if( $recs ) {
+
+        my $ses = OpenSRF::AppSession->create('open-ils.storage');
+        my $req = $ses->request($method, %$args);
+        my $resp = $req->recv($timeout);
+
+        if($resp and $recs = $resp->content) {
 			put_cache($ckey, scalar(@$recs), $recs);
 			$recs = [ @$recs[$offset..($offset + ($limit - 1))] ];
 		} else {
 			$recs = [];
 		}
+
+        $ses->kill_me;
 	}
 
 	my $count = 0;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
index bed087f..7dc650b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
@@ -338,10 +338,16 @@ sub marc_expert_search {
     # nothing to do
     return Apache2::Const::OK if @$query == 0;
 
-    my $results = $U->simplereq(
-        'open-ils.search', 
+    my $timeout = 120;
+    my $ses = OpenSRF::AppSession->create('open-ils.search');
+    my $req = $ses->request(
         'open-ils.search.biblio.marc',
-        {searches => $query, org_unit => $org_unit}, $limit, $offset);
+        {searches => $query, org_unit => $org_unit}, 
+        $limit, $offset, $timeout);
+
+    my $resp = $req->recv($timeout);
+    my $results = $resp ? $resp->content : undef;
+    $ses->kill_me;
 
     if (defined $U->event_code($results)) {
         $self->apache->log->warn(

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

Summary of changes:
 .../lib/OpenILS/Application/Search/Biblio.pm       |   17 ++++++++++++++---
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm |   12 +++++++++---
 2 files changed, 23 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list