Keep track of previous started event ID

Closes #2107

Signed-off-by: Laurie O <laurie_opperman@hotmail.com>
This commit is contained in:
Laurie O 2020-02-26 01:08:03 +10:00
commit 209c999706
No known key found for this signature in database
GPG key ID: AAA23A02196FC956
4 changed files with 31 additions and 3 deletions

View file

@ -49,10 +49,11 @@ class DecisionTask(BaseModel):
hsh["startedEventId"] = self.started_event_id
return hsh
def start(self, started_event_id):
def start(self, started_event_id, previous_started_event_id=None):
self.state = "STARTED"
self.started_timestamp = unix_time()
self.started_event_id = started_event_id
self.previous_started_event_id = previous_started_event_id
def complete(self):
self._check_workflow_execution_open()

View file

@ -82,6 +82,7 @@ class WorkflowExecution(BaseModel):
self._events = []
# child workflows
self.child_workflow_executions = []
self._previous_started_event_id = None
def __repr__(self):
return "WorkflowExecution(run_id: {0})".format(self.run_id)
@ -295,7 +296,8 @@ class WorkflowExecution(BaseModel):
scheduled_event_id=dt.scheduled_event_id,
identity=identity,
)
dt.start(evt.event_id)
dt.start(evt.event_id, self._previous_started_event_id)
self._previous_started_event_id = evt.event_id
def complete_decision_task(
self, task_token, decisions=None, execution_context=None