URLVerify.pm; initial testing tweaks
authorBill Erickson <berick@esilibrary.com>
Wed, 8 Aug 2012 18:15:25 +0000 (14:15 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 8 Aug 2012 18:15:25 +0000 (14:15 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm

index 4df28e5..997cfb3 100644 (file)
@@ -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;