Yield updated instead of initial nested cursor to persist#366
Merged
Conversation
Otherwise we reprocess the last succesfully processed object again when resuming. In a pathologic case, if a nested job is interrupted every time after a single `each_iteration` completes we'd never progress: the cursor would stay at [nil, nil].
bdewater
commented
Mar 29, 2023
| # reset cursor at the index of the nested enumerator that just finished, so we don't skip items when that | ||
| # index is reused in the next nested iteration | ||
| @cursors[next_index] = nil | ||
| @cursors[index] = cursor_from_enumerator |
Contributor
Author
There was a problem hiding this comment.
This change is not necessary to make the tests pass, but it felt more correct/clear inside the else block - it's analogous to how iterate_with_enumerator updates the cursor here:
job-iteration/lib/job-iteration/iteration.rb
Lines 195 to 196 in 158ca2b
Mangara
approved these changes
Mar 30, 2023
Contributor
Mangara
left a comment
There was a problem hiding this comment.
Good catch! I like that we can remove the dup from the instrumented tags too.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Otherwise we reprocess the last successfully processed object again when resuming. In a pathologic case, if a nested job is interrupted every time after a single
each_iterationcompletes we'd never progress: the cursor would stay at[nil, nil].I spelled it out in #364 😅 but I originally worked on this months before and only realized it now.
Follow-up to #310