Check the return value of IKC call to spectre

This commit is contained in:
Paul Driver 2011-05-23 12:51:56 -05:00
parent 1fa911029d
commit edcf276a2f
2 changed files with 7 additions and 13 deletions

View file

@ -677,14 +677,9 @@ sub start {
# hand off the workflow to spectre
$log->info('Could not complete workflow instance '.$self->getId.' in realtime, handing off to Spectre.');
my $spectre = WebGUI::Workflow::Spectre->new($self->session);
$spectre->notify("workflow/addInstance", {cookieName=>$self->session->config->getCookieName, gateway=>$self->session->config->get("gateway"), sitename=>$self->session->config->get("sitename")->[0], instanceId=>$self->getId, priority=>$self->{_data}{priority}});
my $success = $spectre->notify("workflow/addInstance", {cookieName=>$self->session->config->getCookieName, gateway=>$self->session->config->get("gateway"), sitename=>$self->session->config->get("sitename")->[0], instanceId=>$self->getId, priority=>$self->{_data}{priority}});
my $spectreTest = WebGUI::Operation::Spectre::spectreTest($self->session);
if($spectreTest ne "success"){
return WebGUI::International->new($self->session, "Macro_SpectreCheck")->get($spectreTest);
}
return undef;
return $success ? undef : WebGUI::International->new($self->session, "Macro_SpectreCheck")->get($spectreTest);
}
1;

View file

@ -54,7 +54,8 @@ sub DESTROY {
=head2 notify ( module, params )
Sends a message to Spectre.
Sends a message to Spectre. Returns true iff the message was successfully
sent.
=head3 module
@ -78,12 +79,10 @@ sub notify {
timeout=>10
);
if (defined $remote) {
my $result = $remote->post($module, $params);
unless (defined $result) {
$error->warn("Couldn't send command to Spectre because ".$POE::Component::IKC::ClientLite::error);
my $result = $remote->post($module, $params);
return 1 if defined $result;
$error->warn("Couldn't send command to Spectre because ".$POE::Component::IKC::ClientLite::error);
}
$remote->disconnect;
undef $remote;
} else {
$error->warn("Couldn't connect to Spectre because ".$POE::Component::IKC::ClientLite::error);
}