fix: add error handling for index creation in user and agents collections

This commit is contained in:
Alex
2025-08-05 17:19:06 +01:00
parent b1d8266eef
commit 1282e7687f

View File

@@ -62,12 +62,15 @@ user_logs_collection = db["user_logs"]
user_tools_collection = db["user_tools"] user_tools_collection = db["user_tools"]
attachments_collection = db["attachments"] attachments_collection = db["attachments"]
agents_collection.create_index( try:
[("shared", 1)], agents_collection.create_index(
name="shared_index", [("shared_publicly", 1)],
background=True, name="shared_index",
) background=True,
users_collection.create_index("user_id", unique=True) )
users_collection.create_index("user_id", unique=True)
except Exception as e:
current_app.logger.warning(f"Can't create indexes: {e}", )
user = Blueprint("user", __name__) user = Blueprint("user", __name__)
user_ns = Namespace("user", description="User related operations", path="/") user_ns = Namespace("user", description="User related operations", path="/")