On Mon, Jun 07 2021, Derrick Stolee wrote: > On 6/7/2021 10:43 AM, Ævar Arnfjörð Bjarmason wrote: >> Fix a potential incorrect display of the number of items (off by one) >> and stalling of the progress bar in refresh_index(). >> >> The off-by-one error is minor, we should say we're processing the 1st >> item, not the 0th. This along with the next change also allows us to >> remove the last display_progress() call outside the loop, as we'll >> always have reached 100% now. > > This "pre-announce the progress" seems correct and is unlikely > to have a user sitting at "100%" while the loop is actually doing > work on that last cache entry. I guess pre-announce v.s. post-announce is a matter of some philosophy, for O(n) when can we be said to be doing work on n[0]? We entered the for-loop and are doing work on that istate->cache[i] item, so I'd like to think of it more as post-announce :) In any case, I'm changing this to the established pattern we use in most other places in the codebase, this one was an odd one out. Thanks for the review of this.