From 7466c9e8d704a649fcb4bb6bdad6122625df21b5 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 17 Oct 2011 13:38:46 -0400 Subject: [PATCH] streaming hold targeter repairs * 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 --- .../perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm | 2 +- Open-ILS/src/support-scripts/hold_targeter.pl | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index da6a2cea40..2beaae5028 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -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; } diff --git a/Open-ILS/src/support-scripts/hold_targeter.pl b/Open-ILS/src/support-scripts/hold_targeter.pl index 137e2ca40a..cd62227dba 100755 --- a/Open-ILS/src/support-scripts/hold_targeter.pl +++ b/Open-ILS/src/support-scripts/hold_targeter.pl @@ -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(); -- 2.11.0