From 6402ef9d74cb09a40dc964eca8511bd87723f919 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Wed, 7 Sep 2011 16:15:20 -0400 Subject: [PATCH] A/T reactor 'AstCall' can't have global CStoreEditor It's not good for any Evergreen service to try to have a global cstoreeditor instance. Scope it to the handler() sub that needs it, and comment out the thus-far unused/unfinished retrieve() sub. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Mike Rylander --- .../Application/Trigger/Reactor/AstCall.pm | 125 +++++++++--------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm index e664da6320..bddd7e7ba3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm @@ -14,8 +14,6 @@ $Data::Dumper::Indent = 0; my $U = 'OpenILS::Application::AppUtils'; -my $e = new_editor(xact => 1); - # $last_channel_used is: # ~ index (not literal value) of last channel used in a callfile # ~ index is of position in @channels (zero-based) @@ -114,6 +112,8 @@ sub rpc_client { sub handler { my ($self, $env) = @_; + my $e = new_editor(xact => 1); + $logger->info(__PACKAGE__ . ": entered handler"); # assignment, not comparison @@ -297,64 +297,69 @@ sub cleanup { } sub retrieve { - my $self = shift or return; - my $client = rpc_client(); - my $resp = $client->send_request('retrieve'); - unless ($resp and ref $resp) { - $logger->error( - __PACKAGE__ . ": Mediator Error: " . - ($resp ? 'Bad' : 'No') . " response to retrieve request" - ); - return; - } - - # my $count = $resp{match_count}; # how many files we should have - # my @rm_list = (); - my @files = _files($resp); - foreach (@files) { - my $content = $resp->{$_}->content; - my $filename = $resp->{$_}->filename; - unless ($content) { - $logger->error(__PACKAGE__ . - ": Mediator sent incomplete/unintelligible message for " . - "filename " . ($filename || 'UNKNOWN')); - next; - } - my $feedback = feedback_hash($content); - my $output = $e->retrieve_action_trigger_event_output( - $feedback->{event_output} - ); - if ($content == $output->data) { - $logger->error( - __PACKAGE__ . ": Mediator sent duplicate file " - . $resp->{$_}->filename . " for event_output " . - $feedback->{event_output} - ); - } else { - $output->data($content); - } - $e->commit; # defer until after loop? probably not - my $clean = $client->send_request('cleanup', $filename); - # TODO: deletion by (comma-separated) filenames in chunks - # instead of individually? - # push @rm_list, $_; $client->send_request('cleanup', join(',',@rm_list)); - unless ($clean and ref $clean) { - $logger->error( - __PACKAGE__ . ": Mediator Error: " . - ($clean ? 'Bad' : 'No') . - " response to cleanup $filename request"); - next; - } - unless ($clean->{code}->value == 200 and $clean->{delete_count}) { - $logger->error(__PACKAGE__ . ": cleanup $filename returned " . ( - $resp->{faultcode} ? $resp->{faultcode}->value : - $resp->{ code} ? $resp->{ code}->value : - " -- UNKNOWN response '$resp'" - ) . " with delete_count " . - (defined $clean->{delete_count} ? $clean->{delete_count} : 'UNDEF')); - } - } - return @files; + $logger->info("retrieve() not implemented. how'd we get here?"); # XXX + return; } +#sub retrieve { +# my $self = shift or return; +# my $client = rpc_client(); +# my $resp = $client->send_request('retrieve'); +# unless ($resp and ref $resp) { +# $logger->error( +# __PACKAGE__ . ": Mediator Error: " . +# ($resp ? 'Bad' : 'No') . " response to retrieve request" +# ); +# return; +# } +# +# # my $count = $resp{match_count}; # how many files we should have +# # my @rm_list = (); +# my @files = _files($resp); +# foreach (@files) { +# my $content = $resp->{$_}->content; +# my $filename = $resp->{$_}->filename; +# unless ($content) { +# $logger->error(__PACKAGE__ . +# ": Mediator sent incomplete/unintelligible message for " . +# "filename " . ($filename || 'UNKNOWN')); +# next; +# } +# my $feedback = feedback_hash($content); +# my $output = $e->retrieve_action_trigger_event_output( +# $feedback->{event_output} +# ); +# if ($content == $output->data) { +# $logger->error( +# __PACKAGE__ . ": Mediator sent duplicate file " +# . $resp->{$_}->filename . " for event_output " . +# $feedback->{event_output} +# ); +# } else { +# $output->data($content); +# } +# $e->commit; # defer until after loop? probably not +# my $clean = $client->send_request('cleanup', $filename); +# # TODO: deletion by (comma-separated) filenames in chunks +# # instead of individually? +# # push @rm_list, $_; $client->send_request('cleanup', join(',',@rm_list)); +# unless ($clean and ref $clean) { +# $logger->error( +# __PACKAGE__ . ": Mediator Error: " . +# ($clean ? 'Bad' : 'No') . +# " response to cleanup $filename request"); +# next; +# } +# unless ($clean->{code}->value == 200 and $clean->{delete_count}) { +# $logger->error(__PACKAGE__ . ": cleanup $filename returned " . ( +# $resp->{faultcode} ? $resp->{faultcode}->value : +# $resp->{ code} ? $resp->{ code}->value : +# " -- UNKNOWN response '$resp'" +# ) . " with delete_count " . +# (defined $clean->{delete_count} ? $clean->{delete_count} : 'UNDEF')); +# } +# } +# return @files; +#} + 1; -- 2.43.2