Skip to content

Commit d1dfb6d

Browse files
kvfijeffwidman
authored andcommitted
Set length of header value to 0 if None
1 parent 615b9e0 commit d1dfb6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kafka/consumer/fetcher.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ def _unpack_message_set(self, tp, records):
474474
self.config['value_deserializer'],
475475
tp.topic, record.value)
476476
headers = record.headers
477-
header_size = sum(len(h_key.encode("utf-8")) + len(h_val) for h_key, h_val in headers) if headers else -1
477+
header_size = sum(
478+
len(h_key.encode("utf-8")) + (len(h_val) if h_val is not None else 0) for h_key, h_val in
479+
headers) if headers else -1
478480
yield ConsumerRecord(
479481
tp.topic, tp.partition, record.offset, record.timestamp,
480482
record.timestamp_type, key, value, headers, record.checksum,

0 commit comments

Comments
 (0)