From d73305c81ad25f6b8bf5079e3d127a07e42911a5 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Sat, 27 Feb 2021 13:27:09 +0100 Subject: [PATCH 1/6] docs: add more details on use_legacy_flow_control --- google/cloud/pubsub_v1/subscriber/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index f306d2d99..e36c5ca6d 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -199,6 +199,9 @@ def callback(message): *scheduler* to use when executing the callback. This controls how callbacks are executed concurrently. This object must not be shared across multiple SubscriberClients. + use_legacy_flow_control (bool): + If set to ``True``, it disables flow control on the Cloud PubSub server. + Defaults to ``False``. Returns: A :class:`~google.cloud.pubsub_v1.subscriber.futures.StreamingPullFuture` From aac5fed264e2bdfbae24cc50c5cc980c380d14b3 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Sat, 27 Feb 2021 13:52:46 +0100 Subject: [PATCH 2/6] asdsa --- .../subscriber/_protocol/streaming_pull_manager.py | 8 +++++--- google/cloud/pubsub_v1/subscriber/client.py | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py index 8a3ff0e87..e6ac931ed 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py @@ -106,9 +106,11 @@ class StreamingPullManager(object): ``projects/{project}/subscriptions/{subscription}``. flow_control (~google.cloud.pubsub_v1.types.FlowControl): The flow control settings. - use_legacy_flow_control (bool): Disables enforcing flow control settings - at the Cloud PubSub server and uses the less accurate method of only - enforcing flow control at the client side. + use_legacy_flow_control (bool): + If set to ``True``, it disables enforcing flow control settings on the + Cloud PubSub server. Defaults to ``False``. + The less accurate method of enforcing flow control on the client side + is still enabled in both cases. scheduler (~google.cloud.pubsub_v1.scheduler.Scheduler): The scheduler to use to process messages. If not provided, a thread pool-based scheduler will be used. diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index e36c5ca6d..b712ad318 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -200,8 +200,10 @@ def callback(message): how callbacks are executed concurrently. This object must not be shared across multiple SubscriberClients. use_legacy_flow_control (bool): - If set to ``True``, it disables flow control on the Cloud PubSub server. - Defaults to ``False``. + If set to ``True``, it disables enforcing flow control settings on the + Cloud PubSub server. Defaults to ``False``. + The less accurate method of enforcing flow control on the client side + is still enabled in both cases. Returns: A :class:`~google.cloud.pubsub_v1.subscriber.futures.StreamingPullFuture` From 7c023199cbe228c8fd649e82ec26426468b0d72a Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Tue, 16 Mar 2021 14:21:44 -0700 Subject: [PATCH 3/6] Update google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py --- .../pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py index e6ac931ed..f5f7b9363 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py @@ -108,7 +108,7 @@ class StreamingPullManager(object): control settings. use_legacy_flow_control (bool): If set to ``True``, it disables enforcing flow control settings on the - Cloud PubSub server. Defaults to ``False``. + Cloud Pub/Sub server. Defaults to ``False``. The less accurate method of enforcing flow control on the client side is still enabled in both cases. scheduler (~google.cloud.pubsub_v1.scheduler.Scheduler): The scheduler From feaa63905783feeaf916a821b89958ed4ebd8c2a Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Tue, 16 Mar 2021 14:21:50 -0700 Subject: [PATCH 4/6] Update google/cloud/pubsub_v1/subscriber/client.py --- google/cloud/pubsub_v1/subscriber/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index b712ad318..2ac8cbefe 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -201,7 +201,7 @@ def callback(message): across multiple SubscriberClients. use_legacy_flow_control (bool): If set to ``True``, it disables enforcing flow control settings on the - Cloud PubSub server. Defaults to ``False``. + Cloud Pub/Sub server. Defaults to ``False``. The less accurate method of enforcing flow control on the client side is still enabled in both cases. From 89094e3e15e226e824ba9a51c38591b3ea850d81 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Wed, 17 Mar 2021 12:08:46 +0100 Subject: [PATCH 5/6] Remove "less accurate" from flow control docs --- .../subscriber/_protocol/streaming_pull_manager.py | 4 ++-- google/cloud/pubsub_v1/subscriber/client.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py index f5f7b9363..e06cf2a6b 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py @@ -109,8 +109,8 @@ class StreamingPullManager(object): use_legacy_flow_control (bool): If set to ``True``, it disables enforcing flow control settings on the Cloud Pub/Sub server. Defaults to ``False``. - The less accurate method of enforcing flow control on the client side - is still enabled in both cases. + Mind that the client side flow control is always enforced, regardless of + this value. scheduler (~google.cloud.pubsub_v1.scheduler.Scheduler): The scheduler to use to process messages. If not provided, a thread pool-based scheduler will be used. diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index 2ac8cbefe..1874ce7cb 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -145,8 +145,8 @@ def subscribe( a long time to process. The ``use_legacy_flow_control`` argument disables enforcing flow control - settings at the Cloud PubSub server and uses the less accurate method of - only enforcing flow control at the client side. + settings at the Cloud Pub/Sub server, and only the client side flow control + will be enforced. This method starts the receiver in the background and returns a *Future* representing its execution. Waiting on the future (calling @@ -202,8 +202,8 @@ def callback(message): use_legacy_flow_control (bool): If set to ``True``, it disables enforcing flow control settings on the Cloud Pub/Sub server. Defaults to ``False``. - The less accurate method of enforcing flow control on the client side - is still enabled in both cases. + Mind that the client side flow control is always enforced, regardless of + this value. Returns: A :class:`~google.cloud.pubsub_v1.subscriber.futures.StreamingPullFuture` From 149c09f4ddaaab2eea7ffa4ce3a7244729d53e68 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Fri, 2 Apr 2021 09:34:24 +0200 Subject: [PATCH 6/6] Reword parameter description. --- .../subscriber/_protocol/streaming_pull_manager.py | 7 +++---- google/cloud/pubsub_v1/subscriber/client.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py index 299e4be38..b6175f2bc 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py @@ -107,10 +107,9 @@ class StreamingPullManager(object): flow_control (~google.cloud.pubsub_v1.types.FlowControl): The flow control settings. use_legacy_flow_control (bool): - If set to ``True``, it disables enforcing flow control settings on the - Cloud Pub/Sub server. Defaults to ``False``. - Mind that the client side flow control is always enforced, regardless of - this value. + If set to ``True``, flow control at the Cloud Pub/Sub server is disabled, + though client-side flow control is still enabled. If set to ``False`` + (default), both server-side and client-side flow control are enabled. scheduler (~google.cloud.pubsub_v1.scheduler.Scheduler): The scheduler to use to process messages. If not provided, a thread pool-based scheduler will be used. diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index 03c0240ed..b137fbc5f 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -201,10 +201,9 @@ def callback(message): how callbacks are executed concurrently. This object must not be shared across multiple SubscriberClients. use_legacy_flow_control (bool): - If set to ``True``, it disables enforcing flow control settings on the - Cloud Pub/Sub server. Defaults to ``False``. - Mind that the client side flow control is always enforced, regardless of - this value. + If set to ``True``, flow control at the Cloud Pub/Sub server is disabled, + though client-side flow control is still enabled. If set to ``False`` + (default), both server-side and client-side flow control are enabled. await_callbacks_on_shutdown (bool): If ``True``, after canceling the returned future, the latter's ``result()`` method will block until the background stream and its