[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. aaf94d278b24e59000b705d14965d479576c3e54

Evergreen Git git at git.evergreen-ils.org
Wed Oct 3 12:40:19 EDT 2012


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_2_3 has been updated
       via  aaf94d278b24e59000b705d14965d479576c3e54 (commit)
       via  661fe70abe324c082ab9d6d0c1f01c64e2f4c9ef (commit)
      from  ed4c91efd0b2994f465405a790f308d5e1c36af0 (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 aaf94d278b24e59000b705d14965d479576c3e54
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Sep 24 17:12:11 2012 -0400

    TPAC added content lookup uses local server address
    
    Use the current Apache server's IP address instead of apache->hostname
    to determine where to route TPAC added content lookups.  This allows the
    server to handle the added content lookup locally instead of having to
    route out and back into the cluster.
    
    Continue using apache->hostname as the Host header to ensure the proper
    virtualhost is used once the request is received.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index 6f15dab..a70db54 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -433,6 +433,15 @@ sub added_content_stage1 {
     my $key = $self->get_ac_key($rec_id);
     ($key = $key->{value}) =~ s/^\s+//g if $key;
 
+    # Connect to this machine's IP address, using the same 
+    # Host with which our caller used to connect to us.
+    # This avoids us having to route out of the cluster 
+    # and back in to reach the top-level virtualhost.
+    my $ac_addr = $ENV{SERVER_ADDR};
+    my $ac_host = $self->apache->hostname;
+
+    $logger->info("tpac: added content connecting to $ac_addr / $ac_host");
+
     $ctx->{added_content} = {};
     for my $type (@$ac_types) {
         $ctx->{added_content}->{$type} = {content => ''};
@@ -446,14 +455,12 @@ sub added_content_stage1 {
             # connect to the local Evergreen instance (i.e. ourself).  
             # Connecting to oneself should either be very fast (normal) 
             # or very slow (routing problems).
-            my $req = Net::HTTP::NB->new(
-                Host => $self->apache->hostname,
-                Timeout => 1
-            );
+
+            my $req = Net::HTTP::NB->new(Host => $ac_addr, Timeout => 1);
+            $req->host($self->apache->hostname);
 
             if (!$req) {
-                $logger->warn("Unable to connect to " . 
-                    $self->apache->hostname . 
+                $logger->warn("Unable to connect to $ac_addr / $ac_host".
                     " for added content lookup for $key: $@");
                 next;
             }

commit 661fe70abe324c082ab9d6d0c1f01c64e2f4c9ef
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Sep 24 12:50:47 2012 -0400

    Added content connect timeout
    
    Make tpac server-side added content lookups exit after a brief timeout
    when the apache module is unable to open a connection to its own
    top-level hostname (the virtualhost, apache->hostname).
    
    As noted in the code comments, even though we are using Net::Server::NB
    (non-blocking), it's only non-blocking in the sense of content
    retrieval, not in how it calls connect() under the covers.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index 3ccbe64..6f15dab 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -441,10 +441,20 @@ sub added_content_stage1 {
         if ($key) {
             $logger->debug("tpac: starting added content request for $key => $type");
 
-            my $req = Net::HTTP::NB->new(Host => $self->apache->hostname);
+            # Net::HTTP::NB is non-blocking /after/ the initial connect()
+            # Passing Timeout=>1 ensures we wait no longer than 1 second to 
+            # connect to the local Evergreen instance (i.e. ourself).  
+            # Connecting to oneself should either be very fast (normal) 
+            # or very slow (routing problems).
+            my $req = Net::HTTP::NB->new(
+                Host => $self->apache->hostname,
+                Timeout => 1
+            );
 
             if (!$req) {
-                $logger->warn("Unable to fetch added content from " . $self->apache->hostname . ": $@");
+                $logger->warn("Unable to connect to " . 
+                    $self->apache->hostname . 
+                    " for added content lookup for $key: $@");
                 next;
             }
 

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

Summary of changes:
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm |   21 ++++++++++++++++++-
 1 files changed, 19 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list