Skip to content

Commit

Permalink
Merge pull request #985 from t-d-d/pr/array_push
Browse files Browse the repository at this point in the history
Use Array.push() instead of spread/concat
  • Loading branch information
tulios authored Dec 11, 2020
2 parents e1cefda + 0c3fe64 commit ba34eef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/protocol/requests/fetch/v4/decodeMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const decodeMessages = async decoder => {
const magicByte = messagesBuffer.slice(MAGIC_OFFSET).readInt8(0)

if (magicByte === MAGIC_BYTE) {
let records = []
const records = []

while (messagesDecoder.canReadBytes(RECORD_BATCH_OVERHEAD)) {
try {
const recordBatch = await RecordBatchDecoder(messagesDecoder)
records = [...records, ...recordBatch.records]
records.push(...recordBatch.records)
} catch (e) {
// The tail of the record batches can have incomplete records
// due to how maxBytes works. See https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-FetchAPI
Expand Down

0 comments on commit ba34eef

Please sign in to comment.