more minor changes

This commit is contained in:
2026-05-04 17:54:02 -06:00
parent b96c44381a
commit fc7c821d0f
3 changed files with 36 additions and 5 deletions

View File

@@ -110,11 +110,36 @@ class MetricsConsumer:
try:
# Start consumers in separate threads
import threading
def start_user_consumer():
try:
self.user_consumer.start_consuming()
except Exception as e:
logger.error(f"Error en user consumer: {e}")
def start_report_consumer():
try:
self.report_consumer.start_consuming()
except Exception as e:
logger.error(f"Error en report consumer: {e}")
def start_notification_consumer():
try:
self.notification_consumer.start_consuming()
except Exception as e:
logger.error(f"Error en notification consumer: {e}")
def start_moderation_consumer():
try:
self.moderation_consumer.start_consuming()
except Exception as e:
logger.error(f"Error en moderation consumer: {e}")
threads = [
threading.Thread(target=self.user_consumer.start, daemon=True),
threading.Thread(target=self.report_consumer.start, daemon=True),
threading.Thread(target=self.notification_consumer.start, daemon=True),
threading.Thread(target=self.moderation_consumer.start, daemon=True),
threading.Thread(target=start_user_consumer, daemon=True),
threading.Thread(target=start_report_consumer, daemon=True),
threading.Thread(target=start_notification_consumer, daemon=True),
threading.Thread(target=start_moderation_consumer, daemon=True),
]
for t in threads:
t.start()

View File

@@ -129,7 +129,7 @@ class NotificationConsumer:
"""Start consuming messages from RabbitMQ"""
try:
logger.info("Starting Notification Consumer...")
self.consumer.start()
self.consumer.start_consuming()
except Exception as e:
logger.error(f"Error starting notification consumer: {e}", exc_info=True)
raise

View File

@@ -81,6 +81,12 @@ class Settings(BaseSettings):
description="Calidad de compresión WebP (0-100)"
)
# CORS Configuration
cors_origins: list = Field(
default=["http://localhost:3000", "http://localhost:8000", "http://localhost:8001", "http://localhost:8002", "http://localhost:8003", "http://localhost:8004"],
description="Orígenes permitidos para CORS"
)
class Config:
env_file = ".env"
case_sensitive = False