From e0e8a1ea68bcc33d1a07361102eb87d0cfdd94a9 Mon Sep 17 00:00:00 2001
From: Wonil Choi <wonil22.choi@samsung.com>
Date: Wed, 28 Mar 2018 09:55:07 +0900
Subject: [PATCH] Revert "rabbit: Don't prefetch when batch_size is set"

This reverts commit c881baed29db49c5710795496cb07907e35ceaba.

Eventhough batch_size is set, rabbitMQ prefetch count is not changed
at the first time of connection creation. It works only connection reset
cases(i.e. rabbitMQ restart). So this patch can not fix original issue
  https://bugs.launchpad.net/ceilometer/+bug/1551667

Moreover, it makes another bug that messages of sameple queues are not
consumed properly. So revert it.

Change-Id: Ia8ebee8e2a670e46b6a68859bc30e717bd56ed7e
Signed-off-by: Wonil Choi <wonil22.choi@samsung.com>
Closes-bug: 1759755
---
 oslo_messaging/_drivers/amqpdriver.py | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/oslo_messaging/_drivers/amqpdriver.py b/oslo_messaging/_drivers/amqpdriver.py
index deeaba29b..8fc72dbbb 100644
--- a/oslo_messaging/_drivers/amqpdriver.py
+++ b/oslo_messaging/_drivers/amqpdriver.py
@@ -582,12 +582,6 @@ class AMQPDriverBase(base.BaseDriver):
     def listen_for_notifications(self, targets_and_priorities, pool,
                                  batch_size, batch_timeout):
         conn = self._get_connection(rpc_common.PURPOSE_LISTEN)
-        # NOTE(sileht): The application set batch_size, so we don't need to
-        # prefetch more messages, especially for notifications. Notifications
-        # queues can be really big when the consumer have disapear during a
-        # long period, and when it come back, kombu/pyamqp will fetch all
-        # messages it can. So we override the default qos prefetch value
-        conn.connection.rabbit_qos_prefetch_count = batch_size
 
         listener = AMQPListener(self, conn)
         for target, priority in targets_and_priorities: