Skip to content

Conversation

@jeromepl
Copy link
Contributor

@jeromepl jeromepl commented Jun 16, 2025

Thought this was a straightforward enough change, but I am happy to also open an issue if more discussions are needed.

What was changed

Added support for getting a list of workflows one page at a time in a new method Client#list_workflow_page. Example:

first_page = client.list_workflow_page(query, page_size: 10)
first_page.executions.each do
  # ...
end

second_page = client.list_workflow_page(query, page_size: 10, next_page_token: first_page.next_page_token)

Why?

Fetching all workflow executions matching a query can be extremely expensive if there are a lot of matches. The risk of hitting rate limit or other RPC errors is high, and a lot of the time getting all the results is not necessary.
For example, in a user interface showing a list of workflows one page at a time, we want to only get the list of workflows for the currently shown page.

@CLAassistant
Copy link

CLAassistant commented Jun 16, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jeromepl jeromepl marked this pull request as ready for review June 16, 2025 20:46
@jeromepl jeromepl requested a review from a team as a code owner June 16, 2025 20:46
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Mentioned in comment, let's think on design of this just a bit. I opened an issue to track the work.

@jeromepl jeromepl requested a review from cretz June 26, 2025 14:20
@jeromepl
Copy link
Contributor Author

@cretz ready for a new round of review after going with the new approach discussed in #288

@jeromepl jeromepl changed the title Pagination support for list_workflows Pagination support for listing workflows through a new Client#list_workflow_page method Jun 26, 2025
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Only a few hopefully-minor things.

@cretz
Copy link
Member

cretz commented Jun 26, 2025

It looks like there may be CI failures for two things not related to this issue (generated protos have a bit of a new format it seems and Rubocop just released a new check). This is kinda our fault for not using a lock file and always running CI, intentionally, against latest versions. I will fix in #291 before I merge it and then will merge main here (and #286).

@jeromepl jeromepl requested a review from cretz June 27, 2025 13:17
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for sticking with this. Only minor change is to remove < Data. I am working on getting CI fixed in another PR.

@jeromepl jeromepl requested a review from cretz June 27, 2025 14:21
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will be merging #291 (fixes CI), then #286, then this.

@cretz cretz merged commit ec7212b into temporalio:main Jun 27, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants