Use message.requeue instead of message.reject

Message.requeue does exactly the same as message.reject with requeue=True,
so why not to use it directly.

Change-Id: I42462172c2eb5d5c534e3c55ce7dfcc1a7169e31
This commit is contained in:
Stanislav Kudriashev
2014-03-11 15:30:53 +02:00
parent a6930eb537
commit 37bdae0f0c
3 changed files with 13 additions and 13 deletions

View File

@@ -40,7 +40,7 @@ class Server(object):
"""This method is called on incoming request."""
LOG.debug("Got request: %s", request)
# NOTE(skudriashev): Process all incoming requests only if proxy is
# running, otherwise reject and requeue them.
# running, otherwise requeue them.
if self._proxy.is_running:
# NOTE(skudriashev): Process request only if message has been
# acknowledged successfully.
@@ -48,19 +48,19 @@ class Server(object):
# acknowledge message
message.ack()
except kombu_exc.MessageStateError:
LOG.exception("Failed to acknowledge AMQP message")
LOG.exception("Failed to acknowledge AMQP message.")
else:
LOG.debug("AMQP message acknowledged")
LOG.debug("AMQP message acknowledged.")
# spawn new thread to process request
self._executor.submit(self._process_request, request, message)
else:
try:
# reject and requeue message
message.reject(requeue=True)
# requeue message
message.requeue()
except kombu_exc.MessageStateError:
LOG.exception("Failed to reject/requeue AMQP message")
LOG.exception("Failed to requeue AMQP message.")
else:
LOG.debug("AMQP message rejected and requeued")
LOG.debug("AMQP message requeued.")
@staticmethod
def _parse_request(task, task_name, action, arguments, result=None,