More workflows that need to obey the TTL.

This commit is contained in:
Colin Kuskie 2010-05-23 19:12:57 -07:00
parent ca1f5e1c86
commit ac3255e0c6
3 changed files with 7 additions and 2 deletions

View file

@ -119,7 +119,7 @@ sub execute {
}
}
# taking too long, give up
return $self->WAITING(1) if (time() - $start > 50);
return $self->WAITING(1) if (time() - $start > $self->getTTL);
}
# kill temporary files

View file

@ -76,7 +76,7 @@ sub execute {
# keep track of how much time it's taking
my $start = time;
my $limit = 2_500;
my $timeLimit = 60;
my $timeLimit = $self->getTTL;
my $list = $root->getLineage( ['descendants'], { returnObjects => 1,
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],

View file

@ -87,6 +87,7 @@ sub execute {
}
}
my $sth = $self->session->db->read("select groupId,deleteOffset,groupCacheTimeout from groups");
my $expireTime = time() + $self->getTTL();
while (my $data = $sth->hashRef) {
if ($data->{groupCacheTimeout} > 0) {
# there is no need to wait deleteOffset days for expired external group cache data
@ -94,6 +95,10 @@ sub execute {
} else {
$self->session->db->write("delete from groupings where groupId=? and expireDate < ?", [$data->{groupId}, time()-$data->{deleteOffset}]);
}
if (time() > $expireTime) {
$sth->finish;
return $self->WAITING(1);
}
}
return $self->COMPLETE;
}