From 4d57747a9a9f69a5bf10117b28e1f909107905e7 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Tue, 21 Apr 2026 21:22:41 +0100 Subject: [PATCH] 60s heartbeat timeouts on RabbitMQ --- trustgraph-base/trustgraph/base/rabbitmq_backend.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trustgraph-base/trustgraph/base/rabbitmq_backend.py b/trustgraph-base/trustgraph/base/rabbitmq_backend.py index 73b80cb9..a8133a44 100644 --- a/trustgraph-base/trustgraph/base/rabbitmq_backend.py +++ b/trustgraph-base/trustgraph/base/rabbitmq_backend.py @@ -326,7 +326,15 @@ class RabbitMQBackend: port=port, virtual_host=vhost, credentials=pika.PlainCredentials(username, password), - heartbeat=0, + # Heartbeats let us detect silently-dead connections + # (broker restarts, network partitions, orphaned channels) + # within ~2×interval. Consumer threads drive pika's I/O + # loop every 100ms via process_data_events() in receive(), + # so heartbeat frames get pumped automatically. Producers + # reconnect lazily on the next publish if their connection + # has been aged out by the broker. + heartbeat=60, + blocked_connection_timeout=300, ) logger.info(f"RabbitMQ backend: {host}:{port} vhost={vhost}")