You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PubSub subscription.pull() with return_immediately=True causes KeyError #1781
Attempting to pull from a subscription of an empty topic with return_immediately set to 'True' causes an exception to be raised. This should return an empty result, not raise a KeyError in the module, correct?
Example code:
#!/usr/bin/env python
from gcloud import pubsub
# Config
PUBSUB_TOPIC_NAME = 'deleteme'
PUBSUB_SUB_NAME = 'delete_me'
ack_queues = {}
client = pubsub.Client(project="joeholley-mimus01")
topic = client.topic(PUBSUB_TOPIC_NAME)
sub = topic.subscription(PUBSUB_SUB_NAME)
if not topic.exists():
topic.create()
if not sub.exists():
sub.create()
while True:
recv = sub.pull(return_immediately=True,max_messages=1)
print "Received!"
Results:
Traceback (most recent call last):
File "db/db_worker.py", line 135, in <module>
recv = sub.pull(return_immediately=True,max_messages=1)
File "/usr/local/lib/python2.7/dist-packages/gcloud/pubsub/subscription.py", line 249, in pull
self.full_name, return_immediately, max_messages)
File "/usr/local/lib/python2.7/dist-packages/gcloud/pubsub/connection.py", line 419, in subscription_pull
return response['receivedMessages']
KeyError: 'receivedMessages'
Activity
tseaver commentedon May 6, 2016
Thanks for the report! Should be fixed on
mastervia dd38d66.fix: replace deprecated utcfromtimestamp (#1799)
docs: update to use API (#1781)
chore: run bidi_tests independently (#1781)
feat: implement ai.classify() (#1781)
docs: migrate code from googleapis/python-bigquery (#18303)