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

Fix history paging on looking for WFT Fail #1147

Merged

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Make the Go SDK more robust to empty pages from the server when running IsNextWorkflowTaskFailed.

I saw without the change to IsNextWorkflowTaskFailed the unit test TestEmptyPages would return different events and messages if I used the MockHistoryIterator to return empty pages every other request or not.

@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review June 23, 2023 12:52
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner June 23, 2023 12:52
if nextIndex >= len(eh.loadedEvents) && eh.hasMoreEvents() { // current page ends and there is more pages
// Server can return an empty page so if we need the next event we must keep checking until we either get it
// or know we have no more pages to check
for nextIndex >= len(eh.loadedEvents) && eh.hasMoreEvents() { // current page ends and there is more pages
Copy link
Member

Choose a reason for hiding this comment

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

Ug. One might expect such a loop to be in loadMoreEvents and loadMoreEvents have docs that says "This will not return until it has actually loaded more events or there are no more events". But I guess this way the history iterator is non-blocking.

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit e720652 into temporalio:master Jun 23, 2023
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