mirror of
https://git.sr.ht/~phw/scotty
synced 2025-06-03 12:08:34 +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)
|
steps := max(len(items)/100, 1)
|
||||||
return func(yield func(int, T) bool) {
|
return func(yield func(int, T) bool) {
|
||||||
for i, item := range items {
|
for i, item := range items {
|
||||||
yield(i, item)
|
if !yield(i, item) {
|
||||||
|
return
|
||||||
|
}
|
||||||
p.Elapsed++
|
p.Elapsed++
|
||||||
if i%steps == 0 {
|
if i%steps == 0 {
|
||||||
c <- *t
|
c <- *t
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue