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
|
|
@ -83,12 +83,13 @@ sub execute {
|
|||
my $now = WebGUI::DateTime->new($session, $start);
|
||||
my $outdated = DateTime::Duration->new(seconds => $self->get("timeout"));
|
||||
my $pending = WebGUI::Friends->getAllPendingAddRequests($session);
|
||||
my $ttl = $self->getTTL;
|
||||
while (my $invite = $pending->hashRef) {
|
||||
my $sentOn = WebGUI::DateTime->new($session, $invite->{dateSent});
|
||||
if (DateTime::Duration->compare($now - $sentOn, $outdated) == 1) {
|
||||
WebGUI::Friends->new($session, WebGUI::User->new($session, $invite->{friendId}))->rejectAddRequest($invite->{inviteId});
|
||||
}
|
||||
if (time() - $start > 55) {
|
||||
if (time() - $start > $ttl) {
|
||||
$pending->finish;
|
||||
return $self->WAITING;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue