Comparing version 1.4.3 to 1.4.4
@@ -8,2 +8,7 @@ # Changelog | ||
## [1.4.4] - 2018-10-29 | ||
### Fixed | ||
- Protocol produce v3 wasn't filtering `undefined` timestamps and was sending timestamp 0 (`NaN` converted) for all messages #188 | ||
## [1.4.3] - 2018-10-22 | ||
@@ -10,0 +15,0 @@ |
{ | ||
"name": "kafkajs", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"description": "A modern Apache Kafka client for node.js", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
@@ -66,7 +66,11 @@ const Encoder = require('../../../encoder') | ||
const dateNow = Date.now() | ||
let timestamps = messages.map(m => m.timestamp) | ||
timestamps = timestamps.length === 0 ? [dateNow] : timestamps | ||
const messageTimestamps = messages | ||
.map(m => m.timestamp) | ||
.filter(timestamp => timestamp != null) | ||
.sort() | ||
const firstTimestamp = Math.min(...timestamps) | ||
const maxTimestamp = Math.max(...timestamps) | ||
const timestamps = messageTimestamps.length === 0 ? [dateNow] : messageTimestamps | ||
const firstTimestamp = timestamps[0] | ||
const maxTimestamp = timestamps[timestamps.length - 1] | ||
const records = messages.map((message, i) => | ||
@@ -73,0 +77,0 @@ Record({ |
484865
9094