login just before starting work and log out after each request is handled. this...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Jul 2010 21:16:00 +0000 (21:16 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Jul 2010 21:16:00 +0000 (21:16 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16992 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/marc_stream_importer.pl

index f04b824..07350e4 100755 (executable)
@@ -373,6 +373,8 @@ sub process_request {   # The core Net::Server method
 
     my ($imported, $failed) = (0, 0);
 
+    new_auth_token(); # login
+
     if ($real_opts->{noqueue}) {
         ($imported, $failed) = old_process_batch_data($data);
     } else {
@@ -391,6 +393,8 @@ sub process_request {   # The core Net::Server method
     $msg .= "Failed to import $failed records\n" if $failed;
     $msg .= "\x00";
     print $client $msg;
+
+    clear_auth_token(); # logout
 }
 
 
@@ -402,10 +406,17 @@ sub new_auth_token {
     return $authtoken;
 }
 
+sub clear_auth_token {
+    $apputils->simplereq(
+        'open-ils.auth',
+        'open-ils.auth.session.delete',
+        $authtoken
+    );
+}
+
 ##### MAIN ######
 
 osrf_connect($osrf_config);
-new_auth_token();
 print "Calling Net::Server run ", (@ARGV ? "with command-line options: " . join(' ', @ARGV) : ''), "\n";
 __PACKAGE__->run(conf_file => $conf_file);