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

Evergreen Git git at git.evergreen-ils.org
Wed May 15 17:11:07 EDT 2013


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  5796d8f44259aeef257ac60b16b159db7207e989 (commit)
       via  2ffbec542f5b63d83906450d965725a2d08321c4 (commit)
       via  c2916457e6a2a56543e9ebd4b36da9cde6400774 (commit)
      from  870874173ec34ac51af442564210edf6acb6e077 (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 5796d8f44259aeef257ac60b16b159db7207e989
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Apr 30 11:26:00 2013 -0400

    Make sure the "running" indicator goes away
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

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 5ea3602..1b6a9ce 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -1307,7 +1307,7 @@ sub staged_search {
             $cache_data = $cache->get_cache($key) || {};
             last if (!$cache_data->{running});
         }
-    } else { # we're the first ... let's give it a try
+    } elsif (!$cache_data->{0}) { # we're the first ... let's give it a try
         $cache->put_cache($key, { running => $$ }, $cache_timeout / 3);
     }
 
@@ -1409,6 +1409,13 @@ sub staged_search {
         }
     }
 
+    # Let other backends grab our data now that we're done.
+    $cache_data = $cache->get_cache($key);
+    if ($$cache_data{running} and $$cache_data{running} == $$) {
+        delete $$cache_data{running};
+        $cache->put_cache($key, $cache_data, $cache_timeout);
+    }
+
     my @results = grep {defined $_} @$all_results[$user_offset..($user_offset + $user_limit - 1)];
 
 	# refine the estimate if we have more than one superpage

commit 2ffbec542f5b63d83906450d965725a2d08321c4
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Apr 26 11:28:38 2013 -0400

    Add a $cache_timeout-based backstop for infinite loops
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

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 3975eda..5ea3602 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -1302,7 +1302,8 @@ sub staged_search {
     # and complexity, this is close to the best we can do.
 
     if ($cache_data->{running}) { # someone is already doing the search...
-        while ( sleep(1) ) { # sleep for a second ... maybe they'll finish
+        my $stop_looping = time() + $cache_timeout;
+        while ( sleep(1) and time() < $stop_looping ) { # sleep for a second ... maybe they'll finish
             $cache_data = $cache->get_cache($key) || {};
             last if (!$cache_data->{running});
         }

commit c2916457e6a2a56543e9ebd4b36da9cde6400774
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Apr 26 10:49:17 2013 -0400

    "Queue Compression" -- let one do the work for all identical, concurrent searches
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

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 6d149ca..3975eda 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -1293,6 +1293,23 @@ sub staged_search {
     my $facet_key = $key.'_facets';
     my $cache_data = $cache->get_cache($key) || {};
 
+    # First, we want to make sure that someone else isn't currently trying to perform exactly
+    # this same search.  The point is to allow just one instance of a search to fill the needs
+    # of all concurrent, identical searches.  This will avoid spammy searches killing the
+    # database without requiring admins to start locking some IP addresses out entirely.
+    #
+    # There's still a tiny race condition where 2 might run, but without sigificantly more code
+    # and complexity, this is close to the best we can do.
+
+    if ($cache_data->{running}) { # someone is already doing the search...
+        while ( sleep(1) ) { # sleep for a second ... maybe they'll finish
+            $cache_data = $cache->get_cache($key) || {};
+            last if (!$cache_data->{running});
+        }
+    } else { # we're the first ... let's give it a try
+        $cache->put_cache($key, { running => $$ }, $cache_timeout / 3);
+    }
+
     # keep retrieving results until we find enough to 
     # fulfill the user-specified limit and offset
     my $all_results = [];

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

Summary of changes:
 .../lib/OpenILS/Application/Search/Biblio.pm       |   25 ++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list