Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pubsub: emphasize that returned futures may differ from stdlib futures. #6875

Merged
merged 1 commit into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pubsub/docs/publisher/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,15 @@ batch can not exceed 10 megabytes.
Futures
-------

Every call to :meth:`~.pubsub_v1.publisher.client.Client.publish` will return
a class that conforms to the :class:`~concurrent.futures.Future` interface.
Every call to :meth:`~.pubsub_v1.publisher.client.Client.publish` returns
an instance of :class:`google.api_core.future.Future`.

.. note::

The returned future conforms for the most part to the interface of
the standard library's :class:`~concurrent.futures.Future`, but might not
be usable in all cases which expect that exact implementaton.

You can use this to ensure that the publish succeeded:

.. code-block:: python
Expand Down
5 changes: 3 additions & 2 deletions pubsub/google/cloud/pubsub_v1/publisher/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ def publish(self, topic, data, **attrs):
sent as metadata. (These may be text strings or byte strings.)

Returns:
~concurrent.futures.Future: An object conforming to the
``concurrent.futures.Future`` interface.
~google.api_core.future.Future: An object conforming to the
``concurrent.futures.Future`` interface (but not an instance
of that class).
"""
# Sanity check: Is the data being sent as a bytestring?
# If it is literally anything else, complain loudly about it.
Expand Down