a couple small bug fixes

This commit is contained in:
JT Smith 2006-03-19 21:50:49 +00:00
parent 524ea87d36
commit 9dac1d5178
2 changed files with 18 additions and 5 deletions

View file

@ -317,6 +317,15 @@ Suspends a workflow instance for a number of seconds defined in the config file,
sub suspendInstance {
my ($self, $instanceId, $kernel) = @_[OBJECT, ARG0, KERNEL];
$self->debug("Suspending workflow instance ".$instanceId." for ".$self->config->get("suspensionDelay")." seconds.");
# normally this is taken care of by the returnInstanceToQueue method, but we want to free up the running count
# so that other things can be run while this thing is suspended
if ($self->{_instances}{$instanceId}) {
for (my $i=0; $i < scalar(@{$self->{_runningInstances}}); $i++) {
if ($self->{_runningInstances}[$i] eq $instanceId) {
splice(@{$self->{_runningInstances}}, $i, 1);
}
}
}
$kernel->delay_set("returnInstanceToQueue",$self->config->get("suspensionDelay"), $instanceId);
}

View file

@ -216,9 +216,7 @@ sub run {
return "undefined" unless (defined $workflow);
return "disabled" unless ($workflow->get("enabled"));
my $activity = $workflow->getNextActivity($self->get("currentActivityId"));
if (defined $activity) {
$self->set({"currentActivityId",$activity->getId});
} else {
unless (defined $activity) {
$self->delete;
return "done";
}
@ -226,6 +224,7 @@ sub run {
my $class = $self->get("className");
my $method = $self->get("methodName");
my $params = $self->get("parameters");
my $status = "";
if ($class && $method) {
my $cmd = "use $class";
eval($cmd);
@ -238,9 +237,14 @@ sub run {
$self->session->errorHandler->warn("Error instanciating activity (".$activity->getId.") pass-in object: ".$@);
return "error";
}
return $activity->execute($object, $self);
$status = $activity->execute($object, $self);
} else {
$status = $activity->execute(undef, $self);
}
return $activity->execute(undef, $self);
if ($status eq "complete") {
$self->set({"currentActivityId"=>$activity->getId});
}
return $status;
}