Skip to content

Commit c964f8f

Browse files
committedApr 8, 2025
Dont raise KeyError on incomplete.remove(batch)
1 parent 98d7137 commit c964f8f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎kafka/producer/record_accumulator.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,14 @@ def __init__(self):
588588

589589
def add(self, batch):
590590
with self._lock:
591-
return self._incomplete.add(batch)
591+
self._incomplete.add(batch)
592592

593593
def remove(self, batch):
594594
with self._lock:
595-
return self._incomplete.remove(batch)
595+
try:
596+
self._incomplete.remove(batch)
597+
except KeyError:
598+
pass
596599

597600
def all(self):
598601
with self._lock:

0 commit comments

Comments
 (0)