From 9e3f742f9e2a73b07a0374ecd79c8fc4f4806423 Mon Sep 17 00:00:00 2001 From: oli Date: Fri, 29 Mar 2019 19:34:53 +1100 Subject: [PATCH 1/2] Print actual number of messages pulled --- pubsub/cloud-client/subscriber.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubsub/cloud-client/subscriber.py b/pubsub/cloud-client/subscriber.py index 5802218b499..91348b0915c 100644 --- a/pubsub/cloud-client/subscriber.py +++ b/pubsub/cloud-client/subscriber.py @@ -284,7 +284,7 @@ def synchronous_pull(project_id, subscription_name): # Acknowledges the received messages so they will not be sent again. subscriber.acknowledge(subscription_path, ack_ids) - print("Received and acknowledged {} messages. Done.".format(NUM_MESSAGES)) + print("Received and acknowledged {} messages. Done.".format(len(response.received_messages))) # [END pubsub_subscriber_sync_pull] @@ -357,7 +357,7 @@ def worker(msg): if processes: time.sleep(SLEEP_TIME) - print("Received and acknowledged {} messages. Done.".format(NUM_MESSAGES)) + print("Received and acknowledged {} messages. Done.".format(len(response.received_messages))) # [END pubsub_subscriber_sync_pull_with_lease] From 2601083559eda959448a0045677ae39d40bd70da Mon Sep 17 00:00:00 2001 From: oli Date: Fri, 9 Aug 2019 22:48:37 +1000 Subject: [PATCH 2/2] Fix code style --- pubsub/cloud-client/subscriber.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pubsub/cloud-client/subscriber.py b/pubsub/cloud-client/subscriber.py index 91348b0915c..551393bf40a 100644 --- a/pubsub/cloud-client/subscriber.py +++ b/pubsub/cloud-client/subscriber.py @@ -284,7 +284,8 @@ def synchronous_pull(project_id, subscription_name): # Acknowledges the received messages so they will not be sent again. subscriber.acknowledge(subscription_path, ack_ids) - print("Received and acknowledged {} messages. Done.".format(len(response.received_messages))) + print('Received and acknowledged {} messages. Done.'.format( + len(response.received_messages))) # [END pubsub_subscriber_sync_pull] @@ -357,7 +358,8 @@ def worker(msg): if processes: time.sleep(SLEEP_TIME) - print("Received and acknowledged {} messages. Done.".format(len(response.received_messages))) + print('Received and acknowledged {} messages. Done.'.format( + len(response.received_messages))) # [END pubsub_subscriber_sync_pull_with_lease]