code: func (s *scheduler) scheduleDeliveries(pend chan uint64, done chan []byte, quit chan struct{}, wg *sync.WaitGroup) {
  	// Clean up the goroutine and pipeline when done
  	defer wg.Done()
  	defer close(done)
  
  	// Keep reading notifications and scheduling deliveries
  	for {
  		select {
  		case <-quit:
  			return
  
  		case idx, ok := <-pend:
  			// New section retrieval pending
  			if !ok {
  				return
  			}
  			// Wait until the request is honoured
  			s.lock.Lock()
  			res := s.responses[idx]
  			s.lock.Unlock()
  
  			select {
  			case <-quit:
  				return
  			case <-res.done:
  			}
  			// Deliver the result
  			select {
  			case <-quit:
  				return
  			case done <- res.cached:
  			}
  		}
  	}
  }
docs: // scheduleDeliveries reads section acceptance notifications and waits for them
  // to be delivered, pushing them into the output data buffer.