Skip to content

Commit d3aa3f5

Browse files
anguillanneufplamut
authored andcommitted
Fixed return object from subscriber.subscribe() [(#1685)](GoogleCloudPlatform/python-docs-samples#1685)
1 parent 5fd6f78 commit d3aa3f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/snippets/subscriber.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ def callback(message):
255255
print('Received message: {}'.format(message))
256256
message.ack()
257257

258-
subscription = subscriber.subscribe(subscription_path, callback=callback)
258+
future = subscriber.subscribe(subscription_path, callback=callback)
259259

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

0 commit comments

Comments
 (0)