Codebase list golang-github-vbauerster-mpb / 206e3b9
minor: rename rr to refreshRate Vladimir Bauer 3 years ago
2 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
3232 // WithRefreshRate overrides default 150ms refresh rate.
3333 func WithRefreshRate(d time.Duration) ContainerOption {
3434 return func(s *pState) {
35 s.rr = d
35 s.refreshRate = d
3636 }
3737 }
3838
1414 )
1515
1616 const (
17 prr = 150 * time.Millisecond // default RefreshRate
17 defaultRefreshRate = 150 * time.Millisecond
1818 )
1919
2020 // DoneError represents an error when `*mpb.Progress` is done but its functionality is requested.
4545 pool []*Bar
4646
4747 // following are provided/overrided by user
48 rr time.Duration
48 refreshRate time.Duration
4949 idCount int
5050 reqWidth int
5151 popPriority int
7272 // method has been called.
7373 func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
7474 s := &pState{
75 rr: prr,
7675 bHeap: priorityQueue{},
7776 rows: make([]io.Reader, 0, 64),
7877 pool: make([]*Bar, 0, 64),
78 refreshRate: defaultRefreshRate,
79 popPriority: math.MinInt32,
7980 manualRefresh: make(chan interface{}),
8081 shutdownNotifier: make(chan struct{}),
8182 queueBars: make(map[*Bar]*Bar),
82 popPriority: math.MinInt32,
8383 output: os.Stdout,
8484 debugOut: io.Discard,
8585 }
408408 if s.renderDelay != nil {
409409 <-s.renderDelay
410410 }
411 ticker := time.NewTicker(s.rr)
411 ticker := time.NewTicker(s.refreshRate)
412412 defer ticker.Stop()
413413 autoRefresh = ticker.C
414414 }