Skip to content

Commit

Permalink
Fixed return object from subscriber.subscribe() [(#1685)](GoogleClo…
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf authored and plamut committed Jul 10, 2020
1 parent 5fd6f78 commit d3aa3f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/snippets/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ def callback(message):
print('Received message: {}'.format(message))
message.ack()

subscription = subscriber.subscribe(subscription_path, callback=callback)
future = subscriber.subscribe(subscription_path, callback=callback)

# Blocks the thread while messages are coming in through the stream. Any
# exceptions that crop up on the thread will be set on the future.
try:
# When timeout is unspecified, the result method waits indefinitely.
subscription.future.result(timeout=30)
future.result(timeout=30)
except Exception as e:
print(
'Listening for messages on {} threw an Exception: {}.'.format(
Expand Down

0 comments on commit d3aa3f5

Please sign in to comment.