diff --git a/oslo_messaging/_drivers/protocols/amqp/driver.py b/oslo_messaging/_drivers/protocols/amqp/driver.py index 4dca34ba8..0a3f889e7 100644 --- a/oslo_messaging/_drivers/protocols/amqp/driver.py +++ b/oslo_messaging/_drivers/protocols/amqp/driver.py @@ -233,7 +233,6 @@ class ProtonDriver(base.BaseDriver): if retry is not None: raise NotImplementedError('"retry" not implemented by ' 'this transport driver') - request = marshal_request(message, ctxt, envelope) expire = 0 if timeout: @@ -246,14 +245,16 @@ class ProtonDriver(base.BaseDriver): self._ctrl.add_task(task) # wait for the eventloop to process the command. If the command is # an RPC call retrieve the reply message - reply = task.wait(timeout) - if reply: - # TODO(kgiusti) how to handle failure to un-marshal? Must log, and - # determine best way to communicate this failure back up to the - # caller - reply = unmarshal_response(reply, self._allowed_remote_exmods) - LOG.debug("Send to %s returning", target) - return reply + + if wait_for_reply: + reply = task.wait(timeout) + if reply: + # TODO(kgiusti) how to handle failure to un-marshal? + # Must log, and determine best way to communicate this failure + # back up to the caller + reply = unmarshal_response(reply, self._allowed_remote_exmods) + LOG.debug("Send to %s returning", target) + return reply @_ensure_connect_called def send_notification(self, target, ctxt, message, version, diff --git a/oslo_messaging/tests/test_amqp_driver.py b/oslo_messaging/tests/test_amqp_driver.py index 7d0320054..0c355170f 100644 --- a/oslo_messaging/tests/test_amqp_driver.py +++ b/oslo_messaging/tests/test_amqp_driver.py @@ -295,7 +295,6 @@ class TestAmqpNotification(_AmqpBrokerTestCase): 'topic-2.debug'] excepted_targets = [] - exception_count = 0 for version in (1.0, 2.0): for t in targets: try: @@ -303,7 +302,6 @@ class TestAmqpNotification(_AmqpBrokerTestCase): "context", {'target': t}, version) except oslo_messaging.MessageDeliveryFailure: - exception_count += 1 excepted_targets.append(t) listener.join(timeout=30) @@ -314,9 +312,8 @@ class TestAmqpNotification(_AmqpBrokerTestCase): self.assertEqual(topics.count('topic-1.error'), 2) self.assertEqual(topics.count('topic-2.debug'), 2) self.assertEqual(self._broker.dropped_count, 4) - self.assertEqual(exception_count, 4) - self.assertEqual(excepted_targets.count('topic-1.bad'), 2) - self.assertEqual(excepted_targets.count('bad-topic.debug'), 2) + self.assertEqual(excepted_targets.count('topic-1.bad'), 0) + self.assertEqual(excepted_targets.count('bad-topic.debug'), 0) driver.cleanup()