make manualRefresh ater container opts are run
Vladimir Bauer
3 years ago
| 64 | 64 | // method has been called. |
| 65 | 65 | func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress { |
| 66 | 66 | s := &pState{ |
| 67 | hm: make(heapManager), | |
| 68 | rows: make([]io.Reader, 32), | |
| 69 | refreshRate: defaultRefreshRate, | |
| 70 | popPriority: math.MinInt32, | |
| 71 | manualRefresh: make(chan interface{}), | |
| 72 | queueBars: make(map[*Bar]*Bar), | |
| 73 | output: os.Stdout, | |
| 74 | debugOut: io.Discard, | |
| 67 | hm: make(heapManager), | |
| 68 | rows: make([]io.Reader, 32), | |
| 69 | refreshRate: defaultRefreshRate, | |
| 70 | popPriority: math.MinInt32, | |
| 71 | queueBars: make(map[*Bar]*Bar), | |
| 72 | output: os.Stdout, | |
| 73 | debugOut: io.Discard, | |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | for _, opt := range options { |
| 78 | 77 | if opt != nil { |
| 79 | 78 | opt(s) |
| 80 | 79 | } |
| 80 | } | |
| 81 | ||
| 82 | if s.manualRefresh == nil { | |
| 83 | s.manualRefresh = make(chan interface{}) | |
| 81 | 84 | } |
| 82 | 85 | |
| 83 | 86 | ctx, cancel := context.WithCancel(ctx) |