[open-ils-commits] r16879 - trunk/Open-ILS/src/support-scripts (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jul 8 10:31:48 EDT 2010
Author: erickson
Date: 2010-07-08 10:31:46 -0400 (Thu, 08 Jul 2010)
New Revision: 16879
Modified:
trunk/Open-ILS/src/support-scripts/marc_stream_importer.pl
Log:
instead of reading the MARC data directly from the socket, set the end-of-line character appropriately and read the data directly from STDIN. The 'wait' time is now only used as a security measure to prevent accidental hogging of worker processes
Modified: trunk/Open-ILS/src/support-scripts/marc_stream_importer.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/marc_stream_importer.pl 2010-07-08 14:15:04 UTC (rev 16878)
+++ trunk/Open-ILS/src/support-scripts/marc_stream_importer.pl 2010-07-08 14:31:46 UTC (rev 16879)
@@ -321,20 +321,15 @@
}
sub process_request { # The core Net::Server method
- my $self = shift;
- my $socket = $self->{server}->{client};
- my $data = '';
- my $buf;
-
- # Reading <STDIN> blocks until the client is closed. Instead of waiting
- # for that, give each inbound record $wait_time seconds to fully arrive
- # and pull the data directly from the socket
+ local $/ = "\x1D"; # MARC record separator
+ $logger->info("stream parser received contact");
+ my $data;
eval {
- local $SIG{ALRM} = sub { die "alarm\n" };
- alarm $wait_time;
- $data .= $buf while $socket->sysread($buf, $bufsize);
+ alarm $wait_time; # prevent accidental tie ups of backend processes
+ $data = <STDIN>;
alarm 0;
};
+ $logger->info("stream parser read " . length($data) . " bytes");
if ($real_opts->{noqueue}) {
old_process_batch_data($data);
} else {
More information about the open-ils-commits
mailing list