Skip to content

Commit f880e4e

Browse files
authored
Emphasize that returned futures may differ from stdlib futures. (googleapis#6875)
Closes googleapis#6201.
1 parent 18bbb91 commit f880e4e

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

pubsub/docs/publisher/index.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,15 @@ batch can not exceed 10 megabytes.
9494
Futures
9595
-------
9696

97-
Every call to :meth:`~.pubsub_v1.publisher.client.Client.publish` will return
98-
a class that conforms to the :class:`~concurrent.futures.Future` interface.
97+
Every call to :meth:`~.pubsub_v1.publisher.client.Client.publish` returns
98+
an instance of :class:`google.api_core.future.Future`.
99+
100+
.. note::
101+
102+
The returned future conforms for the most part to the interface of
103+
the standard library's :class:`~concurrent.futures.Future`, but might not
104+
be usable in all cases which expect that exact implementaton.
105+
99106
You can use this to ensure that the publish succeeded:
100107

101108
.. code-block:: python

pubsub/google/cloud/pubsub_v1/publisher/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ def publish(self, topic, data, **attrs):
196196
sent as metadata. (These may be text strings or byte strings.)
197197
198198
Returns:
199-
~concurrent.futures.Future: An object conforming to the
200-
``concurrent.futures.Future`` interface.
199+
~google.api_core.future.Future: An object conforming to the
200+
``concurrent.futures.Future`` interface (but not an instance
201+
of that class).
201202
"""
202203
# Sanity check: Is the data being sent as a bytestring?
203204
# If it is literally anything else, complain loudly about it.

0 commit comments

Comments
 (0)