GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add futures for subscriptions. by lukesneeringer · Pull Request #4265 · googleapis/google-cloud-python Conversation
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Seems fine: subscriber = pubsub_v1.SubscriberClient() subscription_path = subscriber.subscription_path( project, subscription_name) def callback(message): print('Received message: {}'.format(message)) message.ack() subcription = subscriber.subscribe(subscription_path, callback=callback) # The subscriber is non-blocking, so we must keep the main thread from # exiting to allow it to process messages in the background. print('Listening for messages on {}'.format(subscription_path)) subscription.future.result()
doesn't |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It does, but if you call it in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| # These objects are all communicated between threads; ensure that | ||
| # any writes to them are atomic. | ||
| # import pdb ; pdb.set_trace() |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Can we have close() send a signal to exit if it's being invoked from the "wrong" thread? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Maybe. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jonparrott This is ready for review. I am going to punt on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@lukesneeringer totally fair |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly fine, but some concerns about making the future public.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return True | ||
|
|
||
| def done(self): | ||
| """Return True if the publish has completed, False otherwise. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return self._result | ||
| raise err | ||
|
|
||
| def exception(self, timeout=None, _wait=1): |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| when the future finishes running. | ||
| """ | ||
| if self.done(): | ||
| fn(self) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| """Set the result of the future to the provided result. | ||
|
|
||
| Args: | ||
| result (str): The message ID. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,176 @@ | |||
| # Copyright 2017, Google Inc. All rights reserved. | |||
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # The publishing-side subclass does not need any special behavior | ||
| # at this time. | ||
| # | ||
| # However, there is still a subclass so that if someone attempts |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Publish future blocks indefinitely if API raises exception Pub/Sub has no way to track errors from the subscriber thread.
There was an error while loading. Please reload this page.