Export a method from Workflow::Activity for timeouts and use it in all current Workflows

This commit is contained in:
Colin Kuskie 2008-08-30 20:34:52 +00:00
parent 85ecaa9a09
commit 726bd5ee05
12 changed files with 36 additions and 12 deletions

View file

@ -90,6 +90,7 @@ sub execute {
my $sth = $session->db->read("select assetData.assetId,asset.className,assetData.revisionDate from asset
left join assetData on asset.assetId=assetData.assetId where assetData.revisionDate<?
order by assetData.revisionDate asc", [$suspectDate]);
my $ttl = $self->getTTL;
while (my ($id, $class, $version) = $sth->array) {
# we never want to purge the current version
@ -110,7 +111,7 @@ sub execute {
}
# give up if we're taking too long
if (time() - $start > 55) {
if (time() - $start > $ttl) {
$log->info("Ran out of time, will pick up with revision $version when we start again.");
$instance->setScratch("purgeOldAssetsLastRevisionDate", $version);
$sth->finish;