Codebase list golang-github-vbauerster-mpb / 6d655d6
rely on defer to push back a bar defer is optimized since go 1.14 Vladimir Bauer 3 years ago
1 changed file(s) with 2 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
286286 var wg sync.WaitGroup
287287 var popCount int
288288 rows := make([]io.Reader, 0, height)
289 pool := make([]*Bar, 0, s.bHeap.Len())
290289 for s.bHeap.Len() > 0 {
291290 var usedRows int
292291 b := heap.Pop(&s.bHeap).(*Bar)
309308 if qb, ok := s.queueBars[b]; ok {
310309 delete(s.queueBars, b)
311310 qb.priority = b.priority
312 pool = append(pool, qb)
311 defer heap.Push(&s.bHeap, qb)
313312 drop = true
314313 } else if s.popCompleted && !b.bs.noPop {
315314 if frame.shutdown > 1 {
325324 continue
326325 }
327326 }
328 pool = append(pool, b)
329 }
330
331 for _, b := range pool {
332 heap.Push(&s.bHeap, b)
327 defer heap.Push(&s.bHeap, b)
333328 }
334329
335330 for i := len(rows) - 1; i >= 0; i-- {