Codebase list golang-github-vbauerster-mpb / 8f99d6e
Drop progress while total is dynamic Vladimir Bauer 8 years ago
1 changed file(s) with 8 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
149149 s.updateTimePerItemEstimate(n, now, next)
150150 s.timeElapsed = now.Sub(s.startTime)
151151 }
152 sum := s.current + int64(n)
153 if s.total > 0 && sum >= s.total {
154 if s.dynamic {
155 sum -= sum * s.dropRatio / 100
156 } else {
157 s.current = s.total
158 s.completed = true
152 s.current += int64(n)
153 if s.dynamic {
154 for s.current >= s.total {
155 s.current -= s.current * s.dropRatio / 100
159156 }
160 return
161 }
162 s.current = sum
157 } else if s.current >= s.total {
158 s.current = s.total
159 s.completed = true
160 }
163161 }:
164162 case <-b.quit:
165163 }