Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Base settings to build other settings files upon.
"""

import socket
from pathlib import Path

import django_stubs_ext
Expand Down Expand Up @@ -363,6 +364,28 @@
"heartbeat": 30, # RabbitMQ heartbeat interval (seconds) - detects broken connections
}

CELERY_BROKER_TRANSPORT_OPTIONS = {
# Custom TCP Keepalives to ensure network stack doesn't silently drop connections
"socket_keepalive": True,
"socket_settings": {
# Start sending Keepalive packets after 60 seconds of silence.
# This forces traffic on the wire, preventing the OpenStack 1-hour timeout.
socket.TCP_KEEPIDLE: 60,
# If no response, retry every 10 seconds.
socket.TCP_KEEPINTVL: 10,
# Give up and close connection after 9 failed attempts.
socket.TCP_KEEPCNT: 9,
},
# Connection Stability Settings
"socket_connect_timeout": 40, # Max time to establish connection
"retry_on_timeout": True, # Retry operations if they time out
"max_connections": 20, # Connection pool limit per process
# REMOVED "socket_timeout: 120" to prevent workers self-destructing during long blocking operations.
Comment thread
mihow marked this conversation as resolved.
}
Comment thread
mihow marked this conversation as resolved.

# Application Heartbeat
CELERY_BROKER_HEARTBEAT = 30
Comment thread
mihow marked this conversation as resolved.
Outdated

# Broker connection retry settings
# Workers will retry forever on connection failures rather than crashing
CELERY_BROKER_CONNECTION_RETRY = True
Expand Down
Loading