From 8860920fe48652c14f0bc6b47128ce06260b821f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 8 Aug 2012 14:15:25 -0400 Subject: [PATCH] URLVerify.pm; initial testing tweaks Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/Application/URLVerify.pm | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm index 4df28e5ee4..997cfb3ff1 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm @@ -1,4 +1,4 @@ -package OpenILS::Application::url_verify; +package OpenILS::Application::URLVerify; use base qw/OpenILS::Application/; use strict; use warnings; use OpenSRF::Utils::Logger qw(:logger); @@ -56,9 +56,9 @@ sub validate_session { $options ||= {}; # loop through list of URLs / session URLs - # see if we've already tested the url, if so copy the status info / redirect_to info and move on + # TODO: see if we've already tested the url, if so copy the status info / redirect_to info and move on # add a sleep (org setting) to the multisession handler - # Avoid testing URLs having the same domain sequentially + # TODO: Avoid testing URLs having the same domain sequentially my $e = new_editor(authtoken => $auth, xact => 1); return $e->die_event unless $e->checkauth; @@ -147,6 +147,15 @@ sub validate_session { my $num_processed = 0; # total number processed, including redirects my $resp_window = 1; + # before we start the real work, let the caller know + # the attempt (id) so recovery is possible. + + $client->respond({ + url_count => $url_count, + total_processed => $num_processed, + attempt => $attempt + }); + my $multises = OpenSRF::MultiSession->new( app => 'open-ils.url_verify', # hey, that's us! @@ -251,7 +260,7 @@ $@ or custom message "Redirect Loop" =cut -sub validate_url { +sub verify_url { my ($self, $client, $auth, $attempt_id, $url_id) = @_; my %seen_urls; @@ -287,7 +296,7 @@ sub validate_url { $seen_urls{$cur_url->url} = $cur_url; - my $url_resp = validate_one_url($e, $attempt, $cur_url, $timeout); + my $url_resp = verify_one_url($e, $attempt, $cur_url, $timeout); # something tragic happened return $url_resp if $U->is_event($url_resp); @@ -334,7 +343,7 @@ sub validate_url { =cut -sub validate_one_url { +sub verify_one_url { my ($e, $attempt, $url, $timeout) = @_; my $url_text = $url->url; @@ -439,6 +448,4 @@ sub validate_one_url { } - - 1; -- 2.11.0