Update workflow activity for wg8.

This commit is contained in:
Colin Kuskie 2010-03-03 20:52:53 -08:00
parent e75989090a
commit cd2c1f5e76

View file

@ -78,8 +78,7 @@ sub execute {
} }
my $log = $self->session->log; my $log = $self->session->log;
# start time to check for timeouts # start time to check for timeouts
my $time = time(); my $finish_time = time() | $self->getTTL;
my $ttl = $self->getTTL;
# get asset list # get asset list
my $scratch = $instance->getScratch("syndicatedassets"); my $scratch = $instance->getScratch("syndicatedassets");
@ -95,8 +94,8 @@ sub execute {
while (my $id = shift(@{$assets})) { while (my $id = shift(@{$assets})) {
# Get RSS data, which will be stored in the cache # Get RSS data, which will be stored in the cache
$log->info("GetSyndicatedContent: Caching for $id"); $log->info("GetSyndicatedContent: Caching for $id");
my $asset = WebGUI::Asset::Wobject::SyndicatedContent->new($self->session, $id); my $asset = eval { WebGUI::Asset::Wobject::SyndicatedContent->newById($self->session, $id); };
if (defined $asset) { if (! Exception::Class->caught()) {
my $feed = $asset->generateFeed; my $feed = $asset->generateFeed;
unless ($feed->isa('XML::FeedPP')) { unless ($feed->isa('XML::FeedPP')) {
$log->error("GetSyndicatedContent: Syndicated Content Asset $id returned an invalid feed"); $log->error("GetSyndicatedContent: Syndicated Content Asset $id returned an invalid feed");
@ -106,11 +105,11 @@ sub execute {
$log->error("GetSyndicatedContent: Couldn't instanciate $id") $log->error("GetSyndicatedContent: Couldn't instanciate $id")
} }
# Check for timeout # Check for timeout
last if (time() - $time > $ttl); last if (time() > $finish_time);
} }
# if there are urls left, we need to process again # if there are urls left, we need to process again
if (scalar(@$assets) > 0) { if (scalar(@{ $assets }) > 0) {
$instance->setScratch("syndicatedassets", JSON->new->encode($assets)); $instance->setScratch("syndicatedassets", JSON->new->encode($assets));
return $self->WAITING(1); return $self->WAITING(1);
} }