code: func (b *batchProducer) returnSomeFailedRecordsToBuffer(res *kinesis.PutRecordsResp, records []batchRecord) {
  	for i, result := range res.Records {
  		record := records[i]
  		if result.ErrorCode != "" {
  			record.sendAttempts++
  
  			if record.sendAttempts < b.config.MaxAttemptsPerRecord {
  				b.logger.Printf("Re-enqueueing failed record to buffer for retry. Error code was: '%v' and message was '%v'", result.ErrorCode, result.ErrorMessage)
  				// Not using b.Add because we want to preserve the value of record.sendAttempts.
  				b.records <- record
  			} else {
  				b.currentStat.RecordsDroppedSinceLastStat++
  				msg := "Dropping failed record; it has hit %v attempts " +
  					"which is the maximum. Error code was: '%v' and message was '%v'."
  				b.logger.Printf(msg, record.sendAttempts, result.ErrorCode, result.ErrorMessage)
  			}
  		}
  	}
  }
docs: // returnSomeFailedRecordsToBuffer can block if the buffer (channel) is full, so you might want to
  // call it in a goroutine.
  // TODO: we should probably use a deque internally as the buffer so we can return records to
  // the front of the queue, so as to preserve order, which is important.