Page MenuHomeSoftware Heritage

D8705.id31499.diff
No OneTemporary

D8705.id31499.diff

diff --git a/swh/journal/writer/kafka.py b/swh/journal/writer/kafka.py
--- a/swh/journal/writer/kafka.py
+++ b/swh/journal/writer/kafka.py
@@ -102,10 +102,12 @@
flush_timeout: float = 120,
producer_class: Type[Producer] = Producer,
anonymize: bool = False,
+ auto_flush: bool = True,
):
self._prefix = prefix
self._prefix_privileged = f"{self._prefix}_privileged"
self.anonymize = anonymize
+ self.auto_flush = auto_flush
if not producer_config:
producer_config = {}
@@ -249,7 +251,8 @@
def write_addition(self, object_type: str, object_: ValueProtocol) -> None:
"""Write a single object to the journal"""
self._write_addition(object_type, object_)
- self.flush()
+ if self.auto_flush:
+ self.flush()
def write_additions(
self, object_type: str, objects: Iterable[ValueProtocol]
@@ -258,4 +261,5 @@
for object_ in objects:
self._write_addition(object_type, object_)
- self.flush()
+ if self.auto_flush:
+ self.flush()

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 17, 4:59 PM (21 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223494

Event Timeline