[Opensrf-commits] r1989 - trunk/src/perl/lib/OpenSRF (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Aug 4 13:32:24 EDT 2010
Author: miker
Date: 2010-08-04 13:32:20 -0400 (Wed, 04 Aug 2010)
New Revision: 1989
Modified:
trunk/src/perl/lib/OpenSRF/AppSession.pm
trunk/src/perl/lib/OpenSRF/Application.pm
Log:
always use respond_complete to finish a request, whether there is a final message or not
Modified: trunk/src/perl/lib/OpenSRF/AppSession.pm
===================================================================
--- trunk/src/perl/lib/OpenSRF/AppSession.pm 2010-08-04 03:20:33 UTC (rev 1988)
+++ trunk/src/perl/lib/OpenSRF/AppSession.pm 2010-08-04 17:32:20 UTC (rev 1989)
@@ -1017,21 +1017,22 @@
my $msg = shift;
return unless ($self and $self->session and !$self->complete);
- my $response;
- if (ref($msg) && UNIVERSAL::isa($msg, 'OpenSRF::DomainObject::oilsResult')) {
- $response = $msg;
- } else {
- $response = new OpenSRF::DomainObject::oilsResult;
- $response->content($msg);
- }
+ if (defined($msg)) {
+ my $response;
+ if (ref($msg) && UNIVERSAL::isa($msg, 'OpenSRF::DomainObject::oilsResult')) {
+ $response = $msg;
+ } else {
+ $response = new OpenSRF::DomainObject::oilsResult;
+ $response->content($msg);
+ }
- push @{$self->{current_chunk}}, $response;
+ push @{$self->{current_chunk}}, $response;
+ }
my $stat = OpenSRF::DomainObject::oilsConnectStatus->new(
statusCode => STATUS_COMPLETE(),
status => 'Request Complete' );
-
$self->session->send( ( map { ('RESULT', $_) } @{$self->{current_chunk}} ), 'STATUS' => $stat, $self->threadTrace);
$self->complete(1);
}
Modified: trunk/src/perl/lib/OpenSRF/Application.pm
===================================================================
--- trunk/src/perl/lib/OpenSRF/Application.pm 2010-08-04 03:20:33 UTC (rev 1988)
+++ trunk/src/perl/lib/OpenSRF/Application.pm 2010-08-04 17:32:20 UTC (rev 1989)
@@ -203,13 +203,8 @@
my $time = sprintf '%.3f', time() - $start;
$log->debug( "Method duration for [$method_name]: ". $time );
- if( defined( $resp ) ) {
- $appreq->respond_complete( $resp );
- } else {
- $appreq->status( OpenSRF::DomainObject::oilsConnectStatus->new(
- statusCode => STATUS_COMPLETE(),
- status => 'Request Complete' ) );
- }
+ $appreq->respond_complete( $resp );
+
} catch Error with {
my $e = shift;
warn "Caught error from 'run' method: $e\n";
@@ -281,14 +276,9 @@
$log->debug( "Method duration for [".$aref->[2]->api_name." -> ".join(', ',@{$aref->[1]}).']: '.$time, DEBUG );
$appreq = $aref->[0];
- if( ref( $response ) ) {
- $appreq->respond_complete( $response );
- } else {
- $appreq->status( OpenSRF::DomainObject::oilsConnectStatus->new(
- statusCode => STATUS_COMPLETE(),
- status => 'Request Complete' ) );
- }
+ $appreq->respond_complete( $response );
$log->debug( "Executed: " . $appreq->threadTrace, INTERNAL );
+
} catch Error with {
my $e = shift;
if(UNIVERSAL::isa($e,"Error")) {
More information about the opensrf-commits
mailing list