Conversation
…ck of iterate returns
Contributor
Author
|
@yegor256 take a look please, happy to clarify anything about the change. |
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.
With
sort_by,Fbe::Iterate#overbuilt the sorted list of values once per repository and walked it with.next, so the value the block returned was never used as the next$before. With factsnfrom 1 to 6 and a block that returnsn + 2, a plain query visited 1 and 4 and stored 6, whilesort_byvisited all six and stored 8, which it had never processed.The sorted list is now kept as an array, and each step takes the first value above the current
$beforewithbsearch. The first step starts from the stored marker, as before, and every later one starts from what the block returned, which is the contract the docs ofoverdescribe. TheStopIterationrescue is gone, sincebsearchsimply givesnilwhen nothing is left, and that already restarts the repository.The tests check the visited values and the stored marker for the case from the issue, and that
sort_byand a plain(min n)query visit the same values for the same block, as settled in #826.Closes #1248