Upgrade pika to 1.1.*.

Upgrade pika to 1.1.* and make some changes accordingly
to comply with the new version.

Fixes #12899.
This commit is contained in:
Rafid Aslam 2019-10-09 09:38:43 +07:00 committed by Tim Abbott
parent c7c6f01236
commit 447f74ae63
6 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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 \

View File

@ -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'

View File

@ -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]

View File

@ -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())