From daca892fe6521218381ac10290e7528a1c778a03 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Sat, 29 May 2021 15:43:58 +0200 Subject: [PATCH] docs: explain that future.cancel() is non-blocking --- google/cloud/pubsub_v1/subscriber/futures.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/google/cloud/pubsub_v1/subscriber/futures.py b/google/cloud/pubsub_v1/subscriber/futures.py index 97a911076..18298b956 100644 --- a/google/cloud/pubsub_v1/subscriber/futures.py +++ b/google/cloud/pubsub_v1/subscriber/futures.py @@ -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.