Update module github.com/vbauerster/mpb/v8 to v8.11.2

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-11-10 11:55:27 +00:00
committed by GitHub
parent 06b0711252
commit a1725914ca
8 changed files with 45 additions and 77 deletions

2
go.mod
View File

@@ -62,7 +62,7 @@ require (
github.com/spf13/cobra v1.10.1 github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10 github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
github.com/vbauerster/mpb/v8 v8.11.1 github.com/vbauerster/mpb/v8 v8.11.2
github.com/vishvananda/netlink v1.3.1 github.com/vishvananda/netlink v1.3.1
go.podman.io/common v0.66.0 go.podman.io/common v0.66.0
go.podman.io/image/v5 v5.38.0 go.podman.io/image/v5 v5.38.0

4
go.sum
View File

@@ -420,8 +420,8 @@ github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vbatts/tar-split v0.12.1 h1:CqKoORW7BUWBe7UL/iqTVvkTBOF8UvOMKOIZykxnnbo= github.com/vbatts/tar-split v0.12.1 h1:CqKoORW7BUWBe7UL/iqTVvkTBOF8UvOMKOIZykxnnbo=
github.com/vbatts/tar-split v0.12.1/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA= github.com/vbatts/tar-split v0.12.1/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA=
github.com/vbauerster/mpb/v8 v8.11.1 h1:mQ7P4hSAydB2f93XzWb3jlHMvaHoNwGPaDz3aJXCEGA= github.com/vbauerster/mpb/v8 v8.11.2 h1:OqLoHznUVU7SKS/WV+1dB5/hm20YLheYupiHhL5+M1Y=
github.com/vbauerster/mpb/v8 v8.11.1/go.mod h1:WlKnGgq39HAZhrOLc74w3YnKgmjTiRDDKGXshXwUTro= github.com/vbauerster/mpb/v8 v8.11.2/go.mod h1:mEB/M353al1a7wMUNtiymmPsEkGlJgeJmtlbY5adCJ8=
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0= github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4= github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4=
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY= github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=

View File

@@ -5,7 +5,6 @@ import (
"context" "context"
"io" "io"
"strings" "strings"
"sync"
"time" "time"
"github.com/acarl005/stripansi" "github.com/acarl005/stripansi"
@@ -266,21 +265,14 @@ func (b *Bar) EwmaIncrBy(n int, iterDur time.Duration) {
func (b *Bar) EwmaIncrInt64(n int64, iterDur time.Duration) { func (b *Bar) EwmaIncrInt64(n int64, iterDur time.Duration) {
select { select {
case b.operateState <- func(s *bState) { case b.operateState <- func(s *bState) {
var wg sync.WaitGroup
wg.Add(len(s.ewmaDecorators))
for _, d := range s.ewmaDecorators { for _, d := range s.ewmaDecorators {
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
go func() {
defer wg.Done()
d.EwmaUpdate(n, iterDur) d.EwmaUpdate(n, iterDur)
}()
} }
s.current += n s.current += n
if s.triggerComplete && s.current >= s.total { if s.triggerComplete && s.current >= s.total {
s.current = s.total s.current = s.total
s.triggerCompletion(b) s.triggerCompletion(b)
} }
wg.Wait()
}: }:
case <-b.ctx.Done(): case <-b.ctx.Done():
} }
@@ -295,21 +287,14 @@ func (b *Bar) EwmaSetCurrent(current int64, iterDur time.Duration) {
select { select {
case b.operateState <- func(s *bState) { case b.operateState <- func(s *bState) {
n := current - s.current n := current - s.current
var wg sync.WaitGroup
wg.Add(len(s.ewmaDecorators))
for _, d := range s.ewmaDecorators { for _, d := range s.ewmaDecorators {
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
go func() {
defer wg.Done()
d.EwmaUpdate(n, iterDur) d.EwmaUpdate(n, iterDur)
}()
} }
s.current = current s.current = current
if s.triggerComplete && s.current >= s.total { if s.triggerComplete && s.current >= s.total {
s.current = s.total s.current = s.total
s.triggerCompletion(b) s.triggerCompletion(b)
} }
wg.Wait()
}: }:
case <-b.ctx.Done(): case <-b.ctx.Done():
} }

View File

@@ -1,6 +1,7 @@
package mpb package mpb
import ( import (
"cmp"
"io" "io"
"sync" "sync"
"time" "time"
@@ -32,9 +33,7 @@ func WithWidth(width int) ContainerOption {
// WithQueueLen sets buffer size of heap manager channel. Ideally it must be // WithQueueLen sets buffer size of heap manager channel. Ideally it must be
// kept at MAX value, where MAX is number of bars to be rendered at the same // kept at MAX value, where MAX is number of bars to be rendered at the same
// time. If len < MAX then backpressure to the scheduler will be increased as // time. Default queue len is 128.
// MAX-len extra goroutines will be launched at each render cycle.
// Default queue len is 128.
func WithQueueLen(len int) ContainerOption { func WithQueueLen(len int) ContainerOption {
return func(s *pState) { return func(s *pState) {
s.hmQueueLen = len s.hmQueueLen = len
@@ -78,21 +77,15 @@ func WithShutdownNotifier(ch chan<- interface{}) ContainerOption {
// is not a terminal then auto refresh is disabled unless WithAutoRefresh // is not a terminal then auto refresh is disabled unless WithAutoRefresh
// option is set. // option is set.
func WithOutput(w io.Writer) ContainerOption { func WithOutput(w io.Writer) ContainerOption {
if w == nil {
w = io.Discard
}
return func(s *pState) { return func(s *pState) {
s.output = w s.output = cmp.Or(w, io.Discard)
} }
} }
// WithDebugOutput sets debug output. // WithDebugOutput sets debug output.
func WithDebugOutput(w io.Writer) ContainerOption { func WithDebugOutput(w io.Writer) ContainerOption {
if w == nil {
w = io.Discard
}
return func(s *pState) { return func(s *pState) {
s.debugOut = w s.debugOut = cmp.Or(w, io.Discard)
} }
} }

View File

@@ -165,7 +165,7 @@ func (wc *WC) Init() WC {
wc.fill = runewidth.FillLeft wc.fill = runewidth.FillLeft
} }
if (wc.C & DSyncWidth) != 0 { if (wc.C & DSyncWidth) != 0 {
// it's deliberate choice to override wsync on each Init() call, // it's deliberate choice to override wc.sync on each Init() call,
// this way globals like WCSyncSpace can be reused // this way globals like WCSyncSpace can be reused
wc.sync = &Sync{make(chan int, 1), make(chan int, 1)} wc.sync = &Sync{make(chan int, 1), make(chan int, 1)}
} }

View File

@@ -17,7 +17,6 @@ const (
h_iter h_iter
h_fix h_fix
h_state h_state
h_end
) )
type heapRequest struct { type heapRequest struct {
@@ -38,13 +37,23 @@ type fixData struct {
lazy bool lazy bool
} }
func (m heapManager) run() { func (m heapManager) run(shutdownNotifier chan<- interface{}) {
var bHeap barHeap var bHeap barHeap
var pMatrix map[int][]*decor.Sync done := make(chan struct{})
var aMatrix map[int][]*decor.Sync defer func() {
close(done)
if shutdownNotifier != nil {
select {
case shutdownNotifier <- []*Bar(bHeap):
case <-time.After(time.Second):
}
}
}()
var sync bool var sync bool
var prevLen int var prevLen int
var pMatrix map[int][]*decor.Sync
var aMatrix map[int][]*decor.Sync
for req := range m { for req := range m {
switch req.cmd { switch req.cmd {
@@ -63,8 +72,8 @@ func (m heapManager) run() {
} }
sync, prevLen = false, bHeap.Len() sync, prevLen = false, bHeap.Len()
} }
syncWidth(pMatrix) syncWidth(pMatrix, done)
syncWidth(aMatrix) syncWidth(aMatrix, done)
case h_push: case h_push:
data := req.data.(pushData) data := req.data.(pushData)
heap.Push(&bHeap, data.bar) heap.Push(&bHeap, data.bar)
@@ -92,17 +101,6 @@ func (m heapManager) run() {
case h_state: case h_state:
ch := req.data.(chan<- bool) ch := req.data.(chan<- bool)
ch <- sync || prevLen != bHeap.Len() ch <- sync || prevLen != bHeap.Len()
case h_end:
ch := req.data.(chan<- interface{})
if ch != nil {
go func() {
select {
case ch <- []*Bar(bHeap):
case <-time.After(time.Second):
}
}()
}
return
} }
} }
} }
@@ -113,14 +111,7 @@ func (m heapManager) sync() {
func (m heapManager) push(b *Bar, sync bool) { func (m heapManager) push(b *Bar, sync bool) {
data := pushData{b, sync} data := pushData{b, sync}
req := heapRequest{cmd: h_push, data: data} m <- heapRequest{cmd: h_push, data: data}
select {
case m <- req:
default:
go func() {
m <- req
}()
}
} }
func (m heapManager) iter(req ...iterRequest) { func (m heapManager) iter(req ...iterRequest) {
@@ -136,23 +127,23 @@ func (m heapManager) state(ch chan<- bool) {
m <- heapRequest{cmd: h_state, data: ch} m <- heapRequest{cmd: h_state, data: ch}
} }
func (m heapManager) end(ch chan<- interface{}) { func syncWidth(matrix map[int][]*decor.Sync, done <-chan struct{}) {
m <- heapRequest{cmd: h_end, data: ch}
}
func syncWidth(matrix map[int][]*decor.Sync) {
for _, column := range matrix { for _, column := range matrix {
go maxWidthDistributor(column) go maxWidthDistributor(column, done)
} }
} }
func maxWidthDistributor(column []*decor.Sync) { func maxWidthDistributor(column []*decor.Sync, done <-chan struct{}) {
var maxWidth int var maxWidth int
for _, s := range column { for _, s := range column {
w := <-s.Tx select {
case w := <-s.Tx:
if w > maxWidth { if w > maxWidth {
maxWidth = w maxWidth = w
} }
case <-done:
return
}
} }
for _, s := range column { for _, s := range column {
s.Rx <- maxWidth s.Rx <- maxWidth

View File

@@ -2,6 +2,7 @@ package mpb
import ( import (
"bytes" "bytes"
"cmp"
"context" "context"
"fmt" "fmt"
"io" "io"
@@ -110,8 +111,8 @@ func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
} }
p.pwg.Add(1) p.pwg.Add(1)
go s.hm.run(s.shutdownNotifier)
go p.serve(s, cw) go p.serve(s, cw)
go s.hm.run()
return p return p
} }
@@ -243,7 +244,10 @@ func (p *Progress) Shutdown() {
} }
func (p *Progress) serve(s *pState, cw *cwriter.Writer) { func (p *Progress) serve(s *pState, cw *cwriter.Writer) {
defer p.pwg.Done() defer func() {
close(s.hm)
p.pwg.Done()
}()
var err error var err error
var w *cwriter.Writer var w *cwriter.Writer
renderReq := s.renderReq renderReq := s.renderReq
@@ -297,7 +301,6 @@ func (p *Progress) serve(s *pState, cw *cwriter.Writer) {
s.hm.state(update) s.hm.state(update)
} }
} }
s.hm.end(s.shutdownNotifier)
return return
} }
} }
@@ -334,7 +337,7 @@ func (s *pState) manualRefreshListener(done chan struct{}) {
} }
func (s *pState) render(cw *cwriter.Writer) (err error) { func (s *pState) render(cw *cwriter.Writer) (err error) {
req := make(iterRequest, 1) req := make(iterRequest, 2)
s.hm.sync() s.hm.sync()
s.hm.iter(req, req) s.hm.iter(req, req)
@@ -345,11 +348,7 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
return err return err
} }
} else { } else {
if s.reqWidth > 0 { width = cmp.Or(s.reqWidth, 80)
width = s.reqWidth
} else {
width = 80
}
height = width height = width
} }

2
vendor/modules.txt vendored
View File

@@ -701,7 +701,7 @@ github.com/ulikunitz/xz/lzma
github.com/vbatts/tar-split/archive/tar github.com/vbatts/tar-split/archive/tar
github.com/vbatts/tar-split/tar/asm github.com/vbatts/tar-split/tar/asm
github.com/vbatts/tar-split/tar/storage github.com/vbatts/tar-split/tar/storage
# github.com/vbauerster/mpb/v8 v8.11.1 # github.com/vbauerster/mpb/v8 v8.11.2
## explicit; go 1.24.0 ## explicit; go 1.24.0
github.com/vbauerster/mpb/v8 github.com/vbauerster/mpb/v8
github.com/vbauerster/mpb/v8/cwriter github.com/vbauerster/mpb/v8/cwriter