use the getTTL method to find the time to pause running a Workflow.
This commit is contained in:
parent
adcc2690f3
commit
8ecf297931
3 changed files with 10 additions and 9 deletions
|
|
@ -102,8 +102,9 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
=cut
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $start = time();
|
||||
my $stop = $start + $self->getTTL;
|
||||
|
||||
# kill temporary assets
|
||||
my $tempspace = WebGUI::Asset->getTempspace($self->session);
|
||||
|
|
@ -125,11 +126,11 @@ sub execute {
|
|||
}
|
||||
}
|
||||
# taking too long, give up
|
||||
return $self->WAITING(1) if (time() - $start > $self->getTTL);
|
||||
return $self->WAITING(1) if (time() > $stop);
|
||||
}
|
||||
|
||||
# kill temporary files
|
||||
return $self->recurseFileSystem($start, $self->session->config->get("uploadsPath")."/temp");
|
||||
return $self->recurseFileSystem($stop, $self->session->config->get("uploadsPath")."/temp");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -147,7 +148,7 @@ The starting path.
|
|||
|
||||
sub recurseFileSystem {
|
||||
my $self = shift;
|
||||
my $start = shift;
|
||||
my $stop = shift;
|
||||
my $path = shift;
|
||||
if (opendir(DIR,$path)) {
|
||||
my @filelist = readdir(DIR);
|
||||
|
|
@ -155,10 +156,10 @@ sub recurseFileSystem {
|
|||
foreach my $file (@filelist) {
|
||||
unless ($file eq "." || $file eq "..") {
|
||||
# taking too long, time to abort
|
||||
return $self->WAITING(1) if (time() - $start > 50);
|
||||
return $self->WAITING(1) if (time() > $stop);
|
||||
|
||||
# must search for children
|
||||
$self->recurseFileSystem($start, $path."/".$file);
|
||||
$self->recurseFileSystem($stop, $path."/".$file);
|
||||
|
||||
# if it's old enough, let's kill it
|
||||
if ($self->checkFileAge($path."/".$file)) {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ sub execute {
|
|||
$msg->addHtml( $self->get('notificationMessage') );
|
||||
$msg->queue;
|
||||
|
||||
if ( time - $time > 60 ) {
|
||||
if ( time - $time > $self->getTTL ) {
|
||||
return $self->WAITING(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ sub execute {
|
|||
|
||||
$asset->deleteThingRecord( $asset->get('thingId'), $record->getId );
|
||||
|
||||
if ( time - $time > 60 ) {
|
||||
if ( time - $time > $self->getTTL ) {
|
||||
return $self->WAITING(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
|
||||
sub execute {
|
||||
my ( $self, $obj, $instance ) = @_;
|
||||
my $timeLimit = time + 55;
|
||||
my $timeLimit = time + self->getTTL;
|
||||
|
||||
my $piped = $instance->getScratch('recurrences')
|
||||
|| $self->generateRecurrenceList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue