Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F11023705
D8705.id31499.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D8705.id31499.diff
View Options
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
Details
Attached
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
Attached To
D8705: writer: make calling flush() in write_addition(s)() optional
Event Timeline
Log In to Comment