summaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb/v5/progress.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2021-01-28 09:17:40 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2021-01-28 04:51:57 -0500
commit75c3b33899954e7a0925426b38fd1084d521c3a0 (patch)
treeff5dafd9eaedf43c87f0a868a779792492d84539 /vendor/github.com/vbauerster/mpb/v5/progress.go
parent9d59daa7ccaea526a1aa742fadab537e77a51330 (diff)
downloadpodman-75c3b33899954e7a0925426b38fd1084d521c3a0.tar.gz
podman-75c3b33899954e7a0925426b38fd1084d521c3a0.tar.bz2
podman-75c3b33899954e7a0925426b38fd1084d521c3a0.zip
Bump github.com/containers/image/v5 from 5.9.0 to 5.10.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.9.0 to 5.10.0. - [Release notes](https://github.com/containers/image/releases) - [Commits](https://github.com/containers/image/compare/v5.9.0...v5.10.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/v5/progress.go')
-rw-r--r--vendor/github.com/vbauerster/mpb/v5/progress.go48
1 files changed, 20 insertions, 28 deletions
diff --git a/vendor/github.com/vbauerster/mpb/v5/progress.go b/vendor/github.com/vbauerster/mpb/v5/progress.go
index ac1ce50ab..fb66ce05d 100644
--- a/vendor/github.com/vbauerster/mpb/v5/progress.go
+++ b/vendor/github.com/vbauerster/mpb/v5/progress.go
@@ -8,6 +8,7 @@ import (
"io"
"io/ioutil"
"log"
+ "math"
"os"
"sync"
"time"
@@ -40,7 +41,6 @@ type pState struct {
pMatrix map[int][]chan int
aMatrix map[int][]chan int
barShutdownQueue []*Bar
- barPopQueue []*Bar
// following are provided/overrided by user
idCount int
@@ -179,7 +179,7 @@ func (p *Progress) BarCount() int {
}
}
-// Wait waits far all bars to complete and finally shutdowns container.
+// Wait waits for all bars to complete and finally shutdowns container.
// After this method has been called, there is no way to reuse *Progress
// instance.
func (p *Progress) Wait() {
@@ -301,27 +301,18 @@ func (s *pState) flush(cw *cwriter.Writer) error {
delete(s.parkedBars, b)
b.toDrop = true
}
+ if s.popCompleted && !b.noPop {
+ lineCount -= b.extendedLines + 1
+ b.toDrop = true
+ }
if b.toDrop {
delete(bm, b)
s.heapUpdated = true
- } else if s.popCompleted {
- if b := b; !b.noPop {
- defer func() {
- s.barPopQueue = append(s.barPopQueue, b)
- }()
- }
}
b.cancel()
}
s.barShutdownQueue = s.barShutdownQueue[0:0]
- for _, b := range s.barPopQueue {
- delete(bm, b)
- s.heapUpdated = true
- lineCount -= b.extendedLines + 1
- }
- s.barPopQueue = s.barPopQueue[0:0]
-
for b := range bm {
heap.Push(&s.bHeap, b)
}
@@ -370,7 +361,7 @@ func (s *pState) makeBarState(total int64, filler BarFiller, options ...BarOptio
}
if s.popCompleted && !bs.noPop {
- bs.priority = -1
+ bs.priority = -(math.MaxInt32 - s.idCount)
}
bs.bufP = bytes.NewBuffer(make([]byte, 0, 128))
@@ -382,17 +373,18 @@ func (s *pState) makeBarState(total int64, filler BarFiller, options ...BarOptio
func syncWidth(matrix map[int][]chan int) {
for _, column := range matrix {
- column := column
- go func() {
- var maxWidth int
- for _, ch := range column {
- if w := <-ch; w > maxWidth {
- maxWidth = w
- }
- }
- for _, ch := range column {
- ch <- maxWidth
- }
- }()
+ go maxWidthDistributor(column)
+ }
+}
+
+var maxWidthDistributor = func(column []chan int) {
+ var maxWidth int
+ for _, ch := range column {
+ if w := <-ch; w > maxWidth {
+ maxWidth = w
+ }
+ }
+ for _, ch := range column {
+ ch <- maxWidth
}
}