[open-ils-commits] [GIT] Evergreen ILS branch rel_2_4 updated. ddb2c93d3c1d3cfbf8443649b251c44734cfb741

Evergreen Git git at git.evergreen-ils.org
Thu May 2 10:12:35 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_4 has been updated
       via  ddb2c93d3c1d3cfbf8443649b251c44734cfb741 (commit)
       via  536f7b5d2b0e04b889686cb378de0a366c24e9ee (commit)
       via  53a31615742505e9fe5d453359b297b713a5290c (commit)
      from  4c3ffb7d7952337e5327644c9f518690c4f750aa (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 ddb2c93d3c1d3cfbf8443649b251c44734cfb741
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>

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 536f7b5d2b0e04b889686cb378de0a366c24e9ee
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>

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 53a31615742505e9fe5d453359b297b713a5290c
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>

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