diff --git a/swh/indexer/storage/writer.py b/swh/indexer/storage/writer.py --- a/swh/indexer/storage/writer.py +++ b/swh/indexer/storage/writer.py @@ -50,6 +50,8 @@ if not self.journal: return + translated = [] + # usually, all the additions in a batch are from the same indexer, # so this cache allows doing a single query for all the entries. tool_cache = {} @@ -65,5 +67,7 @@ entry, tool=tool_cache[tool_id], indexer_configuration_id=None ) - # write to kafka - self.journal.write_addition(obj_type, entry) + translated.append(entry) + + # write to kafka + self.journal.write_additions(obj_type, translated)