Skip to content

Commit fbf92fc

Browse files
authored
fix: resolve the lock for progress bar (#153)
Signed-off-by: chlins <[email protected]>
1 parent 9d964cb commit fbf92fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/pb/pb.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ func (p *ProgressBar) Add(prompt, name string, size int64, reader io.Reader) io.
9797

9898
// Complete completes the progress bar.
9999
func (p *ProgressBar) Complete(name string, msg string) {
100-
p.mu.Lock()
101-
defer p.mu.Unlock()
102-
100+
p.mu.RLock()
103101
bar, ok := p.bars[name]
102+
p.mu.RUnlock()
103+
104104
if ok {
105105
bar.msg = msg
106106
bar.Bar.SetCurrent(bar.size)

0 commit comments

Comments
 (0)