Split thread list into chunks to save memory

This commit is contained in:
2022-09-05 07:20:30 +01:00
parent 6e00f70184
commit f8fc5e1a1b
3 changed files with 17 additions and 7 deletions

2
db.py
View File

@@ -53,6 +53,8 @@ def store_message_bulk(data):
:param msg: dict
"""
print("BULK", len(data))
if not data:
return
split_posts = array_split(data, ceil(len(data) / 10000))
for messages in split_posts:
print("PROCESSING SPLIT OF", len(messages), "MESSAGES")