From e1ac7f8862425e5a8f9b96e28234a0b59e579dbd Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Tue, 28 Nov 2017 15:47:54 +0100 Subject: [PATCH] rabbitmq: don't wait for message ack/requeue I don't see any obvious reason why we should wait ack/requeue is done. This waiter have already be removed from amqp1. https://git.openstack.org/cgit/openstack/oslo.messaging/tree/oslo_messaging/_drivers/amqp1_driver/controller.py#n242 So, this change remove it from rabbitmq driver too. Closes-bug: #1734788 Change-Id: I5ecedc762596181be19410b863851a0054fd6579 (cherry picked from commit c38857e1101027a734a35f4e80bc4084fabc034b) --- oslo_messaging/_drivers/amqpdriver.py | 20 ++++--------------- ...bbit-no-wait-for-ack-9e5de3e1320d7660.yaml | 12 +++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/rabbit-no-wait-for-ack-9e5de3e1320d7660.yaml diff --git a/oslo_messaging/_drivers/amqpdriver.py b/oslo_messaging/_drivers/amqpdriver.py index 539e48b0b..b4d935822 100644 --- a/oslo_messaging/_drivers/amqpdriver.py +++ b/oslo_messaging/_drivers/amqpdriver.py @@ -82,26 +82,14 @@ class MessageOperationsHandler(object): while True: try: - task, event = self._tasks.get(block=False) + task = self._tasks.get(block=False) except moves.queue.Empty: break - try: - task() - finally: - event.set() + task() def do(self, task): - "Put the task in the queue and waits until the task is completed." - if self._executor is None: - raise RuntimeError("Unexpected error, no executor is setuped") - elif self._executor == "blocking": - # NOTE(sileht): Blocking will hang forever if we waiting the - # polling thread - task() - else: - event = threading.Event() - self._tasks.put((task, event)) - event.wait() + "Put the task in the queue." + self._tasks.put(task) class AMQPIncomingMessage(base.RpcIncomingMessage): diff --git a/releasenotes/notes/rabbit-no-wait-for-ack-9e5de3e1320d7660.yaml b/releasenotes/notes/rabbit-no-wait-for-ack-9e5de3e1320d7660.yaml new file mode 100644 index 000000000..4b9d47af3 --- /dev/null +++ b/releasenotes/notes/rabbit-no-wait-for-ack-9e5de3e1320d7660.yaml @@ -0,0 +1,12 @@ +--- +other: + - | + On rabbitmq, in the past, acknownlegement of messages was done within the + application callback thread/greenlet. This thread was blocked until the + message was ack. In newton, we rewrote the message acknownlegement to + ensure we haven't two threads writting the the socket at the same times. + Now all pendings ack are done by the main thread. They are no more reason + to block the application callback thread until the message is ack. Other + driver already release the application callback threads before the message + is acknownleged. This is also the case for rabbitmq, now. +