Ensure activity and decision tasks cannot timeout on a closed workflow

This commit is contained in:
Jean-Baptiste Barth 2015-11-04 22:35:45 +01:00
commit 65c95ab5bc
5 changed files with 44 additions and 7 deletions

View file

@ -54,6 +54,8 @@ class ActivityTask(object):
self.last_heartbeat_timestamp = now_timestamp()
def has_timedout(self):
if not self.workflow_execution.open:
return False
# TODO: handle the "NONE" case
heartbeat_timeout_at = self.last_heartbeat_timestamp + \
int(self.timeouts["heartbeatTimeout"])

View file

@ -45,7 +45,7 @@ class DecisionTask(object):
self.state = "COMPLETED"
def has_timedout(self):
if self.state != "STARTED":
if self.state != "STARTED" or not self.workflow_execution.open:
return False
# TODO: handle the "NONE" case
start_to_close_timeout = self.started_timestamp + \