Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

Commit 07bd15e

Browse files
committed
Fix WorkflowExecution.history(): return full paginated (all pages) history
1 parent e0454dd commit 07bd15e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

swf/models/workflow.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,28 @@ def history(self, *args, **kwargs):
409409
:returns: The workflow execution complete events history
410410
:rtype: swf.models.event.History
411411
"""
412-
event_list = self.connection.get_workflow_execution_history(
412+
response = self.connection.get_workflow_execution_history(
413413
self.domain.name,
414414
self.run_id,
415415
self.workflow_id,
416416
**kwargs
417-
)['events']
417+
)
418+
419+
events = response['events']
420+
next_page = response.get('nextPageToken')
421+
while next_page is not None:
422+
response = self.connection.get_workflow_execution_history(
423+
self.domain.name,
424+
self.run_id,
425+
self.workflow_id,
426+
next_page_token=next_page,
427+
**kwargs
428+
)
429+
430+
events.extend(response['events'])
431+
next_page = response.get('nextPageToken')
418432

419-
return History.from_event_list(event_list)
433+
return History.from_event_list(events)
420434

421435
def signal(self, signal_name, input=None, *args, **kwargs):
422436
"""Records a signal event in the workflow execution history and

0 commit comments

Comments
 (0)