mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-31 10:58:35 +02:00
Fixed iterProgress not stopping if yield returns false
This commit is contained in:
parent
5927f41a83
commit
15755458e9
1 changed files with 3 additions and 1 deletions
|
@ -267,7 +267,9 @@ func iterProgress[T any](
|
|||
steps := max(len(items)/100, 1)
|
||||
return func(yield func(int, T) bool) {
|
||||
for i, item := range items {
|
||||
yield(i, item)
|
||||
if !yield(i, item) {
|
||||
return
|
||||
}
|
||||
p.Elapsed++
|
||||
if i%steps == 0 {
|
||||
c <- *t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue