Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
docs: explain that future.cancel() is non-blocking (#420)
  • Loading branch information
plamut committed Jun 11, 2021
1 parent e907f6e commit c825789
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions google/cloud/pubsub_v1/subscriber/futures.py
Expand Up @@ -46,6 +46,11 @@ def _on_close_callback(self, manager, result):
def cancel(self):
"""Stops pulling messages and shutdowns the background thread consuming
messages.
.. versionchanged:: 2.4.1
The method does not block anymore, it just triggers the shutdown and returns
immediately. To block until the background stream is terminated, call
:meth:`result()` after cancelling the future.
"""
# NOTE: We circumvent the base future's self._state to track the cancellation
# state, as this state has different meaning with streaming pull futures.
Expand Down

0 comments on commit c825789

Please sign in to comment.