fix(deps): update module github.com/vbauerster/mpb/v8 to v8.9.3

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-02-25 23:06:17 +00:00
committed by GitHub
parent 73795f40a2
commit ee3fc74baa
6 changed files with 43 additions and 59 deletions

View File

@@ -45,7 +45,7 @@ type bState struct {
noPop bool
autoRefresh bool
buffers [3]*bytes.Buffer
decorators [2][]decor.Decorator
decorGroups [2][]decor.Decorator
ewmaDecorators []decor.EwmaDecorator
filler BarFiller
extender extenderFunc
@@ -156,24 +156,16 @@ func (b *Bar) SetRefill(amount int64) {
}
}
// TraverseDecorators traverses available decorators and calls cb func
// on each in a new goroutine. Decorators implementing decor.Wrapper
// interface are unwrapped first.
// TraverseDecorators traverses available decorators and calls `cb`
// on each unwrapped one.
func (b *Bar) TraverseDecorators(cb func(decor.Decorator)) {
select {
case b.operateState <- func(s *bState) {
var wg sync.WaitGroup
for _, decorators := range s.decorators {
wg.Add(len(decorators))
for _, d := range decorators {
d := d
go func() {
cb(unwrap(d))
wg.Done()
}()
for _, group := range s.decorGroups {
for _, d := range group {
cb(unwrap(d))
}
}
wg.Wait()
}:
case <-b.ctx.Done():
}
@@ -402,8 +394,8 @@ func (b *Bar) Wait() {
}
func (b *Bar) serve(bs *bState) {
decoratorsOnShutdown := func(decorators []decor.Decorator) {
for _, d := range decorators {
decoratorsOnShutdown := func(group []decor.Decorator) {
for _, d := range group {
if d, ok := unwrap(d).(decor.ShutdownListener); ok {
b.container.bwg.Add(1)
go func() {
@@ -418,8 +410,8 @@ func (b *Bar) serve(bs *bState) {
case op := <-b.operateState:
op(bs)
case <-b.ctx.Done():
decoratorsOnShutdown(bs.decorators[0])
decoratorsOnShutdown(bs.decorators[1])
decoratorsOnShutdown(bs.decorGroups[0])
decoratorsOnShutdown(bs.decorGroups[1])
// bar can be aborted by canceling parent ctx without calling b.Abort
bs.aborted = !bs.completed()
b.bs = bs
@@ -491,8 +483,8 @@ func (b *Bar) wSyncTable() syncTable {
}
func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
decorFiller := func(buf *bytes.Buffer, decorators []decor.Decorator) (err error) {
for _, d := range decorators {
decorFiller := func(buf *bytes.Buffer, group []decor.Decorator) (err error) {
for _, d := range group {
// need to call Decor in any case because of width synchronization
str, width := d.Decor(stat)
if err != nil {
@@ -511,7 +503,7 @@ func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
}
for i, buf := range s.buffers[:2] {
err = decorFiller(buf, s.decorators[i])
err = decorFiller(buf, s.decorGroups[i])
if err != nil {
return nil, err
}
@@ -545,34 +537,20 @@ func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
}
func (s *bState) wSyncTable() (table syncTable) {
var count int
var start int
var row []chan int
for i, decorators := range s.decorators {
for _, d := range decorators {
for i, group := range s.decorGroups {
for _, d := range group {
if ch, ok := d.Sync(); ok {
row = append(row, ch)
count++
}
}
switch i {
case 0:
table[i] = row[0:count]
default:
table[i] = row[len(table[i-1]):count]
}
table[i], start = row[start:], len(row)
}
return table
}
func (s *bState) populateEwmaDecorators(decorators []decor.Decorator) {
for _, d := range decorators {
if d, ok := unwrap(d).(decor.EwmaDecorator); ok {
s.ewmaDecorators = append(s.ewmaDecorators, d)
}
}
}
func (s *bState) triggerCompletion(b *Bar) {
s.triggerComplete = true
if s.autoRefresh {