monitoring refactor
This commit is contained in:
@@ -12,12 +12,7 @@ import pika
|
||||
from pika.adapters.blocking_connection import BlockingChannel
|
||||
from pika.exceptions import AMQPConnectionError, AMQPChannelError, ConnectionClosed
|
||||
|
||||
from .settings import (
|
||||
RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_USERNAME, RABBITMQ_PASSWORD,
|
||||
RABBITMQ_VIRTUAL_HOST, RABBITMQ_CONNECTION_TIMEOUT, RABBITMQ_HEARTBEAT,
|
||||
RABBITMQ_BLOCKED_CONNECTION_TIMEOUT, RABBITMQ_PRODUCTS_QUEUE,
|
||||
RABBITMQ_LOGS_QUEUE, RABBITMQ_EXCHANGE
|
||||
)
|
||||
from .settings import settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -41,17 +36,17 @@ class RabbitMQConnection:
|
||||
Returns:
|
||||
pika.ConnectionParameters: Параметры подключения
|
||||
"""
|
||||
credentials = pika.PlainCredentials(RABBITMQ_USERNAME, RABBITMQ_PASSWORD)
|
||||
credentials = pika.PlainCredentials(settings.rabbitmq_user, settings.rabbitmq_password)
|
||||
return pika.ConnectionParameters(
|
||||
host=RABBITMQ_HOST,
|
||||
port=RABBITMQ_PORT,
|
||||
virtual_host=RABBITMQ_VIRTUAL_HOST,
|
||||
host=settings.rabbitmq_host,
|
||||
port=settings.rabbitmq_port,
|
||||
virtual_host=settings.rabbitmq_vhost,
|
||||
credentials=credentials,
|
||||
connection_attempts=3,
|
||||
retry_delay=5,
|
||||
socket_timeout=RABBITMQ_CONNECTION_TIMEOUT,
|
||||
heartbeat=RABBITMQ_HEARTBEAT,
|
||||
blocked_connection_timeout=RABBITMQ_BLOCKED_CONNECTION_TIMEOUT
|
||||
socket_timeout=30, # Hardcoded for now
|
||||
heartbeat=600, # Hardcoded for now
|
||||
blocked_connection_timeout=300 # Hardcoded for now
|
||||
)
|
||||
|
||||
def connect(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user