code: func fetchAllPendingRequests(
  	ch chan *batchCommandsEntry,
  	maxBatchSize int,
  	entries *[]*batchCommandsEntry,
  	requests *[]*tikvpb.BatchCommandsRequest_Request,
  ) {
  	// Block on the first element.
  	headEntry := <-ch
  	if headEntry == nil {
  		return
  	}
  	*entries = append(*entries, headEntry)
  	*requests = append(*requests, headEntry.req)
  
  	// This loop is for trying best to collect more requests.
  	for len(*entries) < maxBatchSize {
  		select {
  		case entry := <-ch:
  			if entry == nil {
  				return
  			}
  			*entries = append(*entries, entry)
  			*requests = append(*requests, entry.req)
  		default:
  			return
  		}
  	}
  }
docs: // fetchAllPendingRequests fetches all pending requests from the channel.