<!-- any files found in the shared subdir must be inspected
(e.g. file name prefix) to determine the provider. -->
- <shared_subdir>ALL</shared_subdir>
+ <shared_subdir>ALL</shared_subdir><!-- SUPPORT PENDING -->
<!-- providers that don't provide a mechanism to inspect the file
have to push their files to provider-specific locations -->
'poll-interval=i' => 10
);
+# -----------------------------------------------------
+# Command-line args reading / munging
+# -----------------------------------------------------
$OpenILS::Utils::Cronscript::debug=1 if $debug;
$Getopt::Long::debug=1 if $debug > 1;
my $o = OpenILS::Utils::Cronscript->new(\%defaults);
}
}
-print Dumper($real_opts);
+$debug and print Dumper($real_opts);
+
+# -----------------------------------------------------
+# subs
+# -----------------------------------------------------
# log in
sub new_auth_token {
# TODO: delete tmp queue?
}
+my %org_cache;
sub org_from_sn {
my $sn = shift;
+ return $org_cache{$sn} if $org_cache{$sn};
my $org = $editor->search_actor_org_unit({shortname => $sn})->[0];
if (!$org) {
warn "No such org unit in acq_order_reader config: '$sn'\n";
return undef;
}
- return $org;
+ return $org_cache{$sn} = $org;
}
+# translate config info into a request arguments structure
sub args_from_provider_conf {
my $conf = shift;
my %args;
$args{vandelay}->{$opt} = $vconf->{$opt}
}
- # boolean options
+ # bool options
for my $opt (
qw/
create_assets
clear_auth_token();
$logger->info("acq-or: loop processed $processed files");
- $debug and print "Sleeping for $poll_interval seconds...\n";
$SIG{INT} = sub {
print "Cleaning up...\n";
exit; # allows lockfile cleanup
};
- sleep $poll_interval;
+ # processing takes time. If we processed any records
+ # during the current iteration, immediately check again
+ # for more work. Otherwise, wait $poll_interval seconds
+ sleep $poll_interval if $processed == 0;
}
__END__