From a0de2d800ad4fa1d31389d3e64b6a68b0c163508 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 7 Sep 2018 10:32:38 -0400 Subject: [PATCH] Change 'BatchSettings.max_bytes' default. It is documented as '10MB', but enforced as 10000000 bytes. Closes #5898. --- pubsub/google/cloud/pubsub_v1/types.py | 2 +- pubsub/tests/unit/pubsub_v1/publisher/test_publisher_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pubsub/google/cloud/pubsub_v1/types.py b/pubsub/google/cloud/pubsub_v1/types.py index 1ac99a96534b..1f5ca92174e2 100644 --- a/pubsub/google/cloud/pubsub_v1/types.py +++ b/pubsub/google/cloud/pubsub_v1/types.py @@ -40,7 +40,7 @@ ['max_bytes', 'max_latency', 'max_messages'], ) BatchSettings.__new__.__defaults__ = ( - 1024 * 1024 * 10, # max_bytes: 10 MB + 1000 * 1000 * 10, # max_bytes: documented "10 MB", enforced 10000000 0.05, # max_latency: 0.05 seconds 1000, # max_messages: 1,000 ) diff --git a/pubsub/tests/unit/pubsub_v1/publisher/test_publisher_client.py b/pubsub/tests/unit/pubsub_v1/publisher/test_publisher_client.py index 1c0ab91a03d4..9b15e6d4777d 100644 --- a/pubsub/tests/unit/pubsub_v1/publisher/test_publisher_client.py +++ b/pubsub/tests/unit/pubsub_v1/publisher/test_publisher_client.py @@ -31,7 +31,7 @@ def test_init(): # A plain client should have an `api` (the underlying GAPIC) and a # batch settings object, which should have the defaults. assert isinstance(client.api, publisher_client.PublisherClient) - assert client.batch_settings.max_bytes == 10 * (2 ** 20) + assert client.batch_settings.max_bytes == 10 * 1000 * 1000 assert client.batch_settings.max_latency == 0.05 assert client.batch_settings.max_messages == 1000