Codebase list golang-github-vbauerster-mpb / 468b60c
refactor const RefreshRate Vladimir Bauer 9 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
2525 SortBottom
2626 )
2727
28 const refreshRate = 100
28 // RefreshRate
29 const rr = 100
2930
3031 // Progress represents the container that renders Progress bars
3132 type Progress struct {
5657 outChangeReqCh: make(chan io.Writer),
5758 wg: new(sync.WaitGroup),
5859 }
59 go p.server(cwriter.New(os.Stdout))
60 go p.server(cwriter.New(os.Stdout), time.NewTicker(rr*time.Millisecond))
6061 return p
6162 }
6263
114115 }
115116
116117 // server monitors underlying channels and renders any progress bars
117 func (p *Progress) server(cw *cwriter.Writer) {
118 t := time.NewTicker(refreshRate * time.Millisecond)
118 func (p *Progress) server(cw *cwriter.Writer, t *time.Ticker) {
119119 bars := make([]*Bar, 0, 4)
120120 for {
121121 select {