more minor changes
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user