[open-ils-commits] [GIT] Evergreen ILS branch master updated. b263a51180d7e3cbf0025a10e0625e5a75321f1a
Evergreen Git
git at git.evergreen-ils.org
Thu May 2 10:10:21 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, master has been updated
via b263a51180d7e3cbf0025a10e0625e5a75321f1a (commit)
via 6a7c526aaed9af40f7ac7855e6ca3094da2bdc59 (commit)
via 58394533a75a616e36755c514ffe686f537b593e (commit)
from b417d5a57dc26b3180af17097349a3224a5e50cb (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 b263a51180d7e3cbf0025a10e0625e5a75321f1a
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 6a7c526aaed9af40f7ac7855e6ca3094da2bdc59
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 58394533a75a616e36755c514ffe686f537b593e
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