fix: Extract user name in session context for improved performance

This commit is contained in:
JSC
2025-08-17 01:49:47 +02:00
parent 66d22df7dd
commit f598ec2c12

View File

@@ -75,6 +75,9 @@ class ExtractionService:
msg = f"User {user_id} not found" msg = f"User {user_id} not found"
raise ValueError(msg) raise ValueError(msg)
# Extract user name immediately while in session context
user_name = user.name
# Create the extraction record without service detection for fast response # Create the extraction record without service detection for fast response
extraction_data = { extraction_data = {
"url": url, "url": url,
@@ -101,7 +104,7 @@ class ExtractionService:
"error": extraction.error, "error": extraction.error,
"sound_id": extraction.sound_id, "sound_id": extraction.sound_id,
"user_id": extraction.user_id, "user_id": extraction.user_id,
"user_name": user.name, "user_name": user_name,
"created_at": extraction.created_at.isoformat(), "created_at": extraction.created_at.isoformat(),
"updated_at": extraction.updated_at.isoformat(), "updated_at": extraction.updated_at.isoformat(),
} }