From edcf276a2fbbc017045d42b71cc942ac6628c5cf Mon Sep 17 00:00:00 2001 From: Paul Driver Date: Mon, 23 May 2011 12:51:56 -0500 Subject: [PATCH] Check the return value of IKC call to spectre --- lib/WebGUI/Workflow/Instance.pm | 9 ++------- lib/WebGUI/Workflow/Spectre.pm | 11 +++++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/WebGUI/Workflow/Instance.pm b/lib/WebGUI/Workflow/Instance.pm index 7711fbd5a..8353b7701 100644 --- a/lib/WebGUI/Workflow/Instance.pm +++ b/lib/WebGUI/Workflow/Instance.pm @@ -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; diff --git a/lib/WebGUI/Workflow/Spectre.pm b/lib/WebGUI/Workflow/Spectre.pm index 6ed59ac34..b830bd05f 100644 --- a/lib/WebGUI/Workflow/Spectre.pm +++ b/lib/WebGUI/Workflow/Spectre.pm @@ -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); }