Skip to content

Commit

Permalink
Print actual number of messages pulled [(#2078)](GoogleCloudPlatform/…
Browse files Browse the repository at this point in the history
…python-docs-samples#2078)

* Print actual number of messages pulled
  • Loading branch information
olivercoad authored and gguuss committed Aug 12, 2019
1 parent f395682 commit d1a0809
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions samples/snippets/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(NUM_MESSAGES))
print('Received and acknowledged {} messages. Done.'.format(
len(response.received_messages)))
# [END pubsub_subscriber_sync_pull]


Expand Down Expand Up @@ -357,7 +358,8 @@ 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]


Expand Down

0 comments on commit d1a0809

Please sign in to comment.