From a45ff816e9d56eebf8de7b0b3ca521ee0fb62b66 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Wed, 24 Apr 2013 16:45:00 +0100 Subject: [PATCH] Pidbox: publish reply should ignore InconsistencyError --- kombu/pidbox.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kombu/pidbox.py b/kombu/pidbox.py index cc29ce1a..0b42c809 100644 --- a/kombu/pidbox.py +++ b/kombu/pidbox.py @@ -20,6 +20,7 @@ from time import time from . import Exchange, Queue, Consumer, Producer from .clocks import LamportClock from .common import maybe_declare, oid_from +from .exceptions import InconsistencyError from .utils import cached_property, kwdict, uuid REPLY_QUEUE_EXPIRES = 10 @@ -215,9 +216,15 @@ class Mailbox(object): delivery_mode='transient', durable=False) producer = Producer(chan, auto_declare=False) - producer.publish(reply, exchange=exchange, routing_key=routing_key, - declare=[exchange], headers={ - 'ticket': ticket, 'clock': self.clock.forward()}) + try: + producer.publish( + reply, exchange=exchange, routing_key=routing_key, + declare=[exchange], headers={ + 'ticket': ticket, 'clock': self.clock.forward(), + }, + ) + except InconsistencyError: + pass # queue probably deleted and no one is expecting a reply. def _publish(self, type, arguments, destination=None, reply_ticket=None, channel=None, timeout=None):