#my $max_requests = $conf->$service->max_requests;
my $max_requests = $config_client->config_value("apps",$service,"max_requests");
- $logger->debug( "Max Requests for $service is $max_requests", INTERNAL );# if $max_requests;
+ $logger->debug( "Max Requests for $service is $max_requests", INTERNAL ) if (defined $max_requests);
$logger->transport( "AppSession creating new session: $sess_id", INTERNAL );
my ($self, $session, $app_msg) = @_;
if( ! $app_msg ) {
- return 0; # error?
+ return 1; # error?
}
$log->debug( "In Application::handler()", DEBUG );
$log->debug("... Responding with : " . join(" ",$req->responses), DEBUG);
return $req->responses;
} else {
- $log->debug("A top level Request object is responding $resp", DEBUG);
+ $log->debug("A top level Request object is responding $resp", DEBUG) if (defined $resp);
return $resp;
}
} else {
$log->debug("endpoint => [".$session->endpoint."]", DEBUG);
$log->debug("OpenSRF::AppSession->SERVER => [".$session->SERVER()."]", DEBUG);
- $log->debug("Before ALL", DEBUG);
my $val;
if ( $session->endpoint == $session->SERVER() ) {
}
if( $val ) {
+ $log->debug("Passing request up to OpenSRF::Application", DEBUG);
return OpenSRF::Application->handler($session, $self->payload);
+ } else {
+ $log->debug("Request was handled internally", DEBUG);
}
+ $log->debug("Returning to ".join('::',(caller)[0,3]), DEBUG);
return 1;
my $keepalive = $client->config_value("apps", $self->app(), "keepalive");
my $req_counter = 0;
- while( $app_session->state and $app_session->state != $app_session->DISCONNECTED() and
+ while( $app_session and $app_session->state and $app_session->state != $app_session->DISCONNECTED() and
$app_session->find( $app_session->session_id ) ) {
my $before = time;
- $logger->transport( "UnixServer calling queue_wait $keepalive", INTERNAL );
+ $logger->debug( "UnixServer calling queue_wait $keepalive", INTERNAL );
$app_session->queue_wait( $keepalive );
- $logger->transport( "after queue wait $keepalive", INTERNAL );
+ $logger->debug( "after queue wait $keepalive", INTERNAL );
my $after = time;
if( ($after - $before) >= $keepalive ) {
}
my $x = 0;
- while( 1 ) {
- $logger->transport( "Looping on zombies " . $x++ , DEBUG);
- last unless ( $app_session->queue_wait(0));
+ while( $app_session && $app_session->queue_wait(0) ) {
+ $logger->debug( "Looping on zombies " . $x++ , DEBUG);
}
- $logger->transport( "Timed out, disconnected, or auth failed", INFO );
- $app_session->kill_me;
+ $logger->debug( "Timed out, disconnected, or auth failed", INFO );
+ $app_session->kill_me if ($app_session);
$0 = $orig;
$0 =~ s/master/drone/g;
+ if ($ENV{OPENSRF_PROFILE}) {
+ my $file = $0;
+ $file =~ s/\W/_/go;
+ eval "use Devel::Profiler output_file => '/tmp/profiler_$file.out', buffer_size => 0;";
+ if ($@) {
+ $logger->debug("Could not load Devel::Profiler: $@",ERROR);
+ } else {
+ $0 .= ' [PROFILING]';
+ $logger->debug("Running under Devel::Profiler", INFO);
+ }
+ }
+
my $self = shift;
# $logger->transport(