From fc7c821d0fcc3af8badbeacddbbb4c64287cd4f3 Mon Sep 17 00:00:00 2001 From: "Juan M. Ley" Date: Mon, 4 May 2026 17:54:02 -0600 Subject: [PATCH] more minor changes --- src/consumers/metrics_consumer.py | 33 ++++++++++++++++++++++---- src/consumers/notification_consumer.py | 2 +- src/core/config.py | 6 +++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/consumers/metrics_consumer.py b/src/consumers/metrics_consumer.py index 2040c19..13e42cb 100644 --- a/src/consumers/metrics_consumer.py +++ b/src/consumers/metrics_consumer.py @@ -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() diff --git a/src/consumers/notification_consumer.py b/src/consumers/notification_consumer.py index ad9b4c1..ec414bf 100644 --- a/src/consumers/notification_consumer.py +++ b/src/consumers/notification_consumer.py @@ -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 diff --git a/src/core/config.py b/src/core/config.py index b6f0b50..031e66f 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -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