[open-ils-commits] [GIT] Evergreen ILS branch rel_2_2 updated. af1a7ccf5a82e2fbf03f4a8e366502148afb4ef1
Evergreen Git
git at git.evergreen-ils.org
Wed May 15 17:11:40 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_2 has been updated
via af1a7ccf5a82e2fbf03f4a8e366502148afb4ef1 (commit)
via 7b4849c92c6bab2a7dc3615390efc323c9a50712 (commit)
via 447d859b0f391d041300d35002ecd7a36a595233 (commit)
from 7107d94b28dd5f70dc64fb6876dcebe609454170 (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 af1a7ccf5a82e2fbf03f4a8e366502148afb4ef1
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 17fb6f6..21b3f9f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -1262,7 +1262,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);
}
@@ -1364,6 +1364,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 7b4849c92c6bab2a7dc3615390efc323c9a50712
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 20cdd09..17fb6f6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -1257,7 +1257,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 447d859b0f391d041300d35002ecd7a36a595233
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 82ad1af..20cdd09 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -1248,6 +1248,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