Export a method from Workflow::Activity for timeouts and use it in all current Workflows
This commit is contained in:
parent
85ecaa9a09
commit
726bd5ee05
12 changed files with 36 additions and 12 deletions
|
|
@ -81,13 +81,14 @@ sub execute {
|
|||
my $start = time();
|
||||
my $log = $self->session->errorHandler;
|
||||
$log->info('Searching for EMS items that have been in the cart too long.');
|
||||
my $ttl = $self->getTTL;
|
||||
my $items = $self->session->db->read("select itemId, cartId, assetId from cartItem where
|
||||
assetId in (select assetId from asset where className like 'WebGUI::Asset::Sku::EMS%')
|
||||
and DATE_ADD(dateAdded, interval ".($self->get("expireAfter") + 0)." second) < now()");
|
||||
while (my ($itemId, $cartId, $assetId) = $items->array) {
|
||||
$log->info('Removing item '.$itemId.' (asset '.$assetId.') from cart '.$cartId);
|
||||
WebGUI::Shop::Cart->new($self->session, $cartId)->getItem($itemId)->remove;
|
||||
if (time() - $start > 55) {
|
||||
if (time() - $start > $ttl) {
|
||||
$items->finish;
|
||||
$log->('Ran out of time. Will have to expire the rest later.');
|
||||
return $self->WAITING;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue