streaming hold targeter repairs parallelize-hold_targeter-startup
authorBill Erickson <berick@esilibrary.com>
Mon, 17 Oct 2011 17:38:46 +0000 (13:38 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 9 Feb 2012 19:59:15 +0000 (14:59 -0500)
* protect against final undef response in hold_targeter.pl
* while loop does not yield values; use for loop instead
* Go back to fetchall_arrayref;  fetchrow was not returning the expected
data to the client.
* log fatal errors

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/support-scripts/hold_targeter.pl

index da6a2ce..2beaae5 100644 (file)
@@ -346,8 +346,8 @@ sub targetable_holds {
     SQL
     my $sth = action::hold_request->db_Main->prepare_cached($query);
     $sth->execute($check_expire);
+    $client->respond( $_ ) for @{ $sth->fetchall_arrayref };
 
-    $client->respond( $_ ) while ( $sth->fetchrow_arrayref );
     return undef;
 }
 
index 137e2ca..cd62227 100755 (executable)
@@ -58,8 +58,11 @@ if ($parallel == 1) {
     my $storage = OpenSRF::AppSession->create("open-ils.storage");
 
     my $r = $storage->request('open-ils.storage.action.hold_request.targetable_holds.id_list', '24h');
-    while ( my $h = $r->recv->content ) {
-        $multi_targeter->request( 'open-ils.storage.action.hold_request.copy_targeter', '', $h->[0], $h->[1]);
+    while ( my $h = $r->recv ) {
+        die $r->failed->stringify . "\n" if $r->failed;
+        if (my $hold = $h->content) {
+            $multi_targeter->request( 'open-ils.storage.action.hold_request.copy_targeter', '', $hold->[0], $hold->[1]);
+        }
     }
 
     $storage->disconnect();