Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dev_utils/mongo_hooks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import itertools
import logging

Expand Down Expand Up @@ -68,6 +69,10 @@ def normalize_file(file_dict, task_id):

new_dict["_id"] = key
file_dict[FILE_REF_KEY] = key
# 16MB limit handling
if new_dict.get("strings") and new_dict["strings"] and sys.getsizeof(new_dict["strings"]) > 16793600:
log.warning("strings are bigger than 16MB, truncating")
new_dict["strings"] = []
return UpdateOne({"_id": key}, {"$set": new_dict, "$addToSet": {TASK_IDS_KEY: task_id}}, upsert=True, hint=[("_id", 1)])


Expand Down
Loading