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

@ -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;
}