qingstor / qsctl

Advanced command line tool for QingStor Object Storage.
Apache License 2.0
23 stars 13 forks source link

cmd/progress-bar: Fix data race in progress bar #284

Closed Prnyself closed 4 years ago

Prnyself commented 4 years ago

When task done more quickly than progress bar render, the wg would cause data race. Because the WaitProgress would call wait() as write before wg.Add() as read. So we add the wg at the start of StartProgress, and done while call WaitProgress for balance. See more details in #283

codecov[bot] commented 4 years ago

Codecov Report

Merging #284 into master will increase coverage by 0.00%. The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #284   +/-   ##
=======================================
  Coverage   49.60%   49.60%           
=======================================
  Files          21       21           
  Lines        1014     1016    +2     
=======================================
+ Hits          503      504    +1     
- Misses        507      508    +1     
  Partials        4        4           
Impacted Files Coverage Δ
cmd/qsctl/taskutils/progress.go 81.25% <66.66%> (-0.57%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e77ea9d...a6ca3e2. Read the comment docs.