Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal::Client::get_workflow_history does not fetch complete history due to pagination #289

Open
cduanfigma opened this issue Mar 8, 2024 · 1 comment · May be fixed by #290
Open

Comments

@cduanfigma
Copy link

The method as-is doesn't use the next_page_token in the response to continue fetching results:

def get_workflow_history(namespace:, workflow_id:, run_id:)
history_response = connection.get_workflow_execution_history(
namespace: namespace,
workflow_id: workflow_id,
run_id: run_id
)
Workflow::History.new(history_response.history.events)
end

I'm thinking of opening a PR to rewrite this to paginate and get the complete history like how it's done in fetch_full_history here. Just wanted to check if there were any objections.

def fetch_full_history
events = task.history.events.to_a
next_page_token = task.next_page_token
until next_page_token.empty?
response = connection.get_workflow_execution_history(
namespace: namespace,
workflow_id: task.workflow_execution.workflow_id,
run_id: task.workflow_execution.run_id,
next_page_token: next_page_token
)
events += response.history.events.to_a
next_page_token = response.next_page_token
end
Workflow::History.new(events)
end

@cduanfigma cduanfigma linked a pull request Mar 11, 2024 that will close this issue
@DeRauk
Copy link
Contributor

DeRauk commented Apr 6, 2024

@cduanfigma Thank you for the PR! I left some comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants