From: Bill Erickson Date: Thu, 9 Aug 2012 20:06:34 +0000 (-0400) Subject: URLVerify.pm; avoid re-processing same url repairs; honor delay=0 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cfadf43531741ad6215a45219d4139d4b9c93ebf;p=evergreen%2Fequinox.git URLVerify.pm; avoid re-processing same url repairs; honor delay=0 Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm index f379bbe411..64ec64bae2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm @@ -375,9 +375,13 @@ sub collect_verify_attempt_and_settings { my $org = $attempt->session->owning_lib; - if (!$cache{delay}{$org}) { + if (!$cache{timeout}{$org}) { + $cache{delay}{$org} = $U->ou_ancestor_setting_value( - $org, 'url_verify.url_verification_delay', $e) || 2; + $org, 'url_verify.url_verification_delay', $e); + + # 0 is a valid delay + $cache{delay}{$org} = 2 unless defined $cache{delay}{$org}; $cache{redirects}{$org} = $U->ou_ancestor_setting_value( $org, 'url_verify.url_verification_max_redirects', $e) || 20; @@ -402,9 +406,9 @@ sub collect_verify_attempt_and_settings { } -# finds the url_verfication for any url processed within this -# verification attempt whose full_url matches the full_url of -# the provided URL. +# searches for a completed url_verfication for any url processed +# within this verification attempt whose full_url matches the +# full_url of the provided URL. sub find_matching_url_for_attempt { my ($e, $attempt, $url) = @_; @@ -420,6 +424,15 @@ sub find_matching_url_for_attempt { '+uvu' => { id => {'!=' => $url->id}, full_url => $url->full_url + }, + + # There could be multiple verifications for matching URLs + # We only want a verification that completed. + # Note also that 2 identical URLs processed within the same + # sub-batch will have to each be fully processed in their own + # right, since neither knows how the other will ultimately fare. + '+uvuv' => { + res_time => {'!=' => undef} } } })->[0];