From 447f74ae63fb753319aafadc014b908c7a174ccd Mon Sep 17 00:00:00 2001 From: Rafid Aslam Date: Wed, 9 Oct 2019 09:38:43 +0700 Subject: [PATCH] Upgrade pika to 1.1.*. Upgrade pika to 1.1.* and make some changes accordingly to comply with the new version. Fixes #12899. --- requirements/common.in | 2 +- requirements/dev.txt | 6 +++--- requirements/prod.txt | 6 +++--- version.py | 2 +- zerver/lib/queue.py | 10 +++++----- zerver/tests/test_queue.py | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/requirements/common.in b/requirements/common.in index 65a4217032..910f86426d 100644 --- a/requirements/common.in +++ b/requirements/common.in @@ -70,7 +70,7 @@ markdown-include mock # Needed to access rabbitmq -pika==0.13.* # https://github.com/zulip/zulip/issues/12899 +pika # Needed to access our database psycopg2 --no-binary psycopg2 diff --git a/requirements/dev.txt b/requirements/dev.txt index c41e0edbde..25e68f82e5 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -517,9 +517,9 @@ pickleshare==0.7.5 \ --hash=sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca \ --hash=sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56 \ # via ipython -pika==0.13.1 \ - --hash=sha256:b0640085f1d6398fd47bb16a17713053e26578192821ea5d928772b8e6a28789 \ - --hash=sha256:b785e0d5f74a94781bd7d020862eb137d2b56cef2a21475aadbe5bcc8ec4db15 +pika==1.1.0 \ + --hash=sha256:4e1a1a6585a41b2341992ec32aadb7a919d649eb82904fd8e4a4e0871c8cf3af \ + --hash=sha256:9fa76ba4b65034b878b2b8de90ff8660a59d925b087c5bb88f8fdbb4b64a1dbf pillow==6.2.1 \ --hash=sha256:047d9473cf68af50ac85f8ee5d5f21a60f849bc17d348da7fc85711287a75031 \ --hash=sha256:0f66dc6c8a3cc319561a633b6aa82c44107f12594643efa37210d8c924fc1c71 \ diff --git a/requirements/prod.txt b/requirements/prod.txt index f5232a6832..1002fa6945 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -343,9 +343,9 @@ pickleshare==0.7.5 \ --hash=sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca \ --hash=sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56 \ # via ipython -pika==0.13.1 \ - --hash=sha256:b0640085f1d6398fd47bb16a17713053e26578192821ea5d928772b8e6a28789 \ - --hash=sha256:b785e0d5f74a94781bd7d020862eb137d2b56cef2a21475aadbe5bcc8ec4db15 +pika==1.1.0 \ + --hash=sha256:4e1a1a6585a41b2341992ec32aadb7a919d649eb82904fd8e4a4e0871c8cf3af \ + --hash=sha256:9fa76ba4b65034b878b2b8de90ff8660a59d925b087c5bb88f8fdbb4b64a1dbf pillow==6.2.1 \ --hash=sha256:047d9473cf68af50ac85f8ee5d5f21a60f849bc17d348da7fc85711287a75031 \ --hash=sha256:0f66dc6c8a3cc319561a633b6aa82c44107f12594643efa37210d8c924fc1c71 \ diff --git a/version.py b/version.py index 7ffe8fb0e8..71ffc3ae49 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = '60.1' +PROVISION_VERSION = '61.0' diff --git a/zerver/lib/queue.py b/zerver/lib/queue.py index 1c2113bc34..253093c7ae 100644 --- a/zerver/lib/queue.py +++ b/zerver/lib/queue.py @@ -52,7 +52,7 @@ class SimpleQueueClient: credentials = pika.PlainCredentials(settings.RABBITMQ_USERNAME, settings.RABBITMQ_PASSWORD) return pika.ConnectionParameters(settings.RABBITMQ_HOST, - heartbeat_interval=self.rabbitmq_heartbeat, + heartbeat=self.rabbitmq_heartbeat, credentials=credentials) def _generate_ctag(self, queue_name: str) -> str: @@ -60,8 +60,8 @@ class SimpleQueueClient: def _reconnect_consumer_callback(self, queue: str, consumer: Consumer) -> None: self.log.info("Queue reconnecting saved consumer %s to queue %s" % (consumer, queue)) - self.ensure_queue(queue, lambda: self.channel.basic_consume(consumer, - queue=queue, + self.ensure_queue(queue, lambda: self.channel.basic_consume(queue, + consumer, consumer_tag=self._generate_ctag(queue))) def _reconnect_consumer_callbacks(self) -> None: @@ -124,7 +124,7 @@ class SimpleQueueClient: self.consumers[queue_name].add(wrapped_consumer) self.ensure_queue(queue_name, - lambda: self.channel.basic_consume(wrapped_consumer, queue=queue_name, + lambda: self.channel.basic_consume(queue_name, wrapped_consumer, consumer_tag=self._generate_ctag(queue_name))) def register_json_consumer(self, queue_name: str, @@ -282,7 +282,7 @@ class TornadoQueueClient(SimpleQueueClient): self.consumers[queue_name].add(wrapped_consumer) self.ensure_queue(queue_name, - lambda: self.channel.basic_consume(wrapped_consumer, queue=queue_name, + lambda: self.channel.basic_consume(queue_name, wrapped_consumer, consumer_tag=self._generate_ctag(queue_name))) queue_client = None # type: Optional[SimpleQueueClient] diff --git a/zerver/tests/test_queue.py b/zerver/tests/test_queue.py index d451bb71c0..633f6fbc19 100644 --- a/zerver/tests/test_queue.py +++ b/zerver/tests/test_queue.py @@ -14,7 +14,7 @@ class TestTornadoQueueClient(ZulipTestCase): def test_on_open_closed(self, mock_cxn: mock.MagicMock, mock_get_logger: mock.MagicMock) -> None: connection = TornadoQueueClient() - connection.connection.channel.side_effect = ConnectionClosed + connection.connection.channel.side_effect = ConnectionClosed('500', 'test') connection._on_open(mock.MagicMock())