Pidbox: publish reply should ignore InconsistencyError

This commit is contained in:
Ask Solem 2013-04-24 16:45:00 +01:00
parent d31a9eacb6
commit a45ff816e9
1 changed files with 10 additions and 3 deletions

View File

@ -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):