From 7442b7d4dbdc38b7fe658b689c78fa0ffb89e88d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Fri, 23 Dec 2016 11:58:18 +0100
Subject: [PATCH] code cleanup

---
 .travis.yml          |  3 +--
 coolamqp/handler.py  | 11 ++---------
 coolamqp/messages.py |  3 +--
 tests/test_basics.py |  2 --
 4 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index c2b5a6c..8c29529 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,8 +7,7 @@ sudo: required
 script:
  - nosetests --with-coverage
 install:
- - pip install coverage
- - pip install codeclimate-test-reporter
+ - pip install coverage codeclimate-test-reporter
  - pip install -r requirements.txt
 after_success:
  - CODECLIMATE_REPO_TOKEN=e8e05973a6c49139de5f98013cd285f9238b78d20f053f37f6e7deeab2c2c52f codeclimate-test-reporter
diff --git a/coolamqp/handler.py b/coolamqp/handler.py
index 93e2f05..007c0c3 100644
--- a/coolamqp/handler.py
+++ b/coolamqp/handler.py
@@ -63,11 +63,7 @@ class ClusterHandlerThread(threading.Thread):
                 for queue in self.queues_by_consumer_tags.values():
                     self.backend.queue_declare(queue)
                     if queue.exchange is not None:
-                        if isinstance(queue.exchange, Exchange):
-                            self.backend.queue_bind(queue, queue.exchange)
-                        else:
-                            for exchange in queue.exchange:
-                                self.backend.queue_bind(queue, exchange)
+                        self.backend.queue_bind(queue, queue.exchange)
                     self.backend.basic_consume(queue)
 
             except ConnectionFailedError as e:
@@ -82,10 +78,7 @@ class ClusterHandlerThread(threading.Thread):
                 if self.is_terminating:
                     raise SystemError('Thread was requested to terminate')
 
-                if exponential_backoff_delay < 60:
-                    exponential_backoff_delay *= 2
-                else:
-                    exponential_backoff_delay = 60
+                exponential_backoff_delay = max(60, exponential_backoff_delay * 2)
             else:
                 self.cluster.connected = True
                 self.event_queue.put(ConnectionUp(initial=self.first_connect))
diff --git a/coolamqp/messages.py b/coolamqp/messages.py
index a3667bd..74e068a 100644
--- a/coolamqp/messages.py
+++ b/coolamqp/messages.py
@@ -98,8 +98,7 @@ class Queue(object):
             reestablished, this name will CHANGE AGAIN, and be reflected in this object.
             This change will be done before CoolAMQP signals reconnection.
         :param durable: Is the queue durable?
-        :param exchange: Exchange(s) this queue is bound to. None for no binding.
-            This might be a single Exchange object, or an iterable of exchanges.
+        :param exchange: Exchange for this queue to bind to. None for no binding.
         :param exclusive: Is this queue exclusive?
         :param auto_delete: Is this queue auto_delete ?
         """
diff --git a/tests/test_basics.py b/tests/test_basics.py
index 6507dc8..092acd2 100644
--- a/tests/test_basics.py
+++ b/tests/test_basics.py
@@ -21,7 +21,6 @@ class TestThings(unittest.TestCase):
         self.assertIsInstance(amqp.drain(1), ConnectionUp)
         amqp.shutdown()
 
-
 class TestBasics(unittest.TestCase):
     def setUp(self):
         self.amqp = getamqp()
@@ -144,4 +143,3 @@ class TestBasics(unittest.TestCase):
 
         self.assertIsInstance(self.amqp.drain(wait=4), MessageReceived)
         self.assertIsInstance(self.amqp.drain(wait=4), MessageReceived)
-
-- 
GitLab