mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
mattermost_import: Log when processing messages.
This logs a line for every batch of messages processed by process_list_in_batches.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import hashlib
|
||||
import logging
|
||||
import re
|
||||
import secrets
|
||||
from collections.abc import Callable
|
||||
@@ -30,13 +31,14 @@ def process_list_in_batches(
|
||||
lst: list[T], chunk_size: int, process_batch: Callable[[list[T]], None]
|
||||
) -> None:
|
||||
offset = 0
|
||||
|
||||
total_message_length = len(lst)
|
||||
while True:
|
||||
items = lst[offset : offset + chunk_size]
|
||||
if not items:
|
||||
break
|
||||
process_batch(items)
|
||||
offset += chunk_size
|
||||
offset = min(offset + chunk_size, total_message_length)
|
||||
logging.info("Processed messages up to %s / %s", offset, total_message_length)
|
||||
|
||||
|
||||
def optional_bytes_to_mib(value: int | None) -> int | None:
|
||||
|
@@ -912,6 +912,8 @@ class RocketChatImporter(ZulipTestCase):
|
||||
"INFO:root:Done processing emoji",
|
||||
"INFO:root:Direct message group channel found. UIDs: ['LdBZ7kPxtKESyHPEe', 'M2sXGqoQRJQwQoXY2', 'os6N2Xg2JkNMCSW9Z']",
|
||||
"INFO:root:skipping direct messages discussion mention: Discussion with Hermione",
|
||||
"INFO:root:Processed messages up to 35 / 35",
|
||||
"INFO:root:Processed messages up to 8 / 8",
|
||||
"INFO:root:Exporting migration status",
|
||||
],
|
||||
)
|
||||
|
Reference in New Issue
Block a user