diff --git a/bar.go b/bar.go index 2b57c1b..e9baa76 100644 --- a/bar.go +++ b/bar.go @@ -52,7 +52,7 @@ filler BarFiller middleware func(BarFiller) BarFiller extender extenderFunc - refreshCh chan interface{} + manualRefresh chan interface{} wait struct { bar *Bar // key for (*pState).queueBars @@ -185,7 +185,7 @@ if s.current >= s.total { s.current = s.total s.completed = true - go b.forceRefresh(s.refreshCh) + go b.forceRefresh(s.manualRefresh) } else { s.triggerComplete = true } @@ -213,7 +213,7 @@ if triggerCompleteNow { s.current = s.total s.completed = true - go b.forceRefresh(s.refreshCh) + go b.forceRefresh(s.manualRefresh) } }: case <-b.done: @@ -230,7 +230,7 @@ if s.triggerComplete && s.current >= s.total { s.current = s.total s.completed = true - go b.forceRefresh(s.refreshCh) + go b.forceRefresh(s.manualRefresh) } }: case <-b.done: @@ -259,7 +259,7 @@ if s.triggerComplete && s.current >= s.total { s.current = s.total s.completed = true - go b.forceRefresh(s.refreshCh) + go b.forceRefresh(s.manualRefresh) } }: case <-b.done: @@ -319,7 +319,7 @@ } s.aborted = true s.dropOnComplete = drop - go b.forceRefresh(s.refreshCh) + go b.forceRefresh(s.manualRefresh) }: case <-b.done: } diff --git a/container_option.go b/container_option.go index b9ead2c..7ef42f2 100644 --- a/container_option.go +++ b/container_option.go @@ -41,7 +41,7 @@ // Refresh will occur upon receive value from provided ch. func WithManualRefresh(ch chan interface{}) ContainerOption { return func(s *pState) { - s.externalRefresh = ch + s.manualRefresh = ch s.disableAutoRefresh = true } } diff --git a/progress.go b/progress.go index 3bb1ee3..8aba481 100644 --- a/progress.go +++ b/progress.go @@ -53,7 +53,7 @@ popCompleted bool outputDiscarded bool disableAutoRefresh bool - externalRefresh chan interface{} + manualRefresh chan interface{} renderDelay <-chan struct{} shutdownNotifier chan struct{} queueBars map[*Bar]*Bar @@ -74,15 +74,15 @@ func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress { ctx, cancel := context.WithCancel(ctx) s := &pState{ - rr: prr, - bHeap: priorityQueue{}, - rows: make([]io.Reader, 0, 64), - pool: make([]*Bar, 0, 64), - externalRefresh: make(chan interface{}), - queueBars: make(map[*Bar]*Bar), - popPriority: math.MinInt32, - output: os.Stdout, - debugOut: io.Discard, + rr: prr, + bHeap: priorityQueue{}, + rows: make([]io.Reader, 0, 64), + pool: make([]*Bar, 0, 64), + manualRefresh: make(chan interface{}), + queueBars: make(map[*Bar]*Bar), + popPriority: math.MinInt32, + output: os.Stdout, + debugOut: io.Discard, } for _, opt := range options { @@ -392,7 +392,7 @@ select { case t := <-autoRefresh: ch <- t - case x := <-s.externalRefresh: + case x := <-s.manualRefresh: if t, ok := x.(time.Time); ok { ch <- t } else { @@ -427,12 +427,12 @@ func (s *pState) makeBarState(total int64, filler BarFiller, options ...BarOption) *bState { bs := &bState{ - id: s.idCount, - priority: s.idCount, - reqWidth: s.reqWidth, - total: total, - filler: filler, - refreshCh: s.externalRefresh, + id: s.idCount, + priority: s.idCount, + reqWidth: s.reqWidth, + total: total, + filler: filler, + manualRefresh: s.manualRefresh, } if total > 0 {