-
Notifications
You must be signed in to change notification settings - Fork 214
Description
Calling StreamingPullFuture.cancel() invokes close() on the StreamingPullManager instance, but the latter method is now non-blocking as of version v2.4.1, meaning that StreamingPullFuture.cancel() has become non-blocking as well.
This can be problematic if subscriber client is used as a context manager, and cancelling the future is the last action in it. Exiting the with block closes the underlying transport, but the streaming pull shutdown might still be in progress. If a, say, NACK request is made during the shutdown after the transport has already been closed, an error occurs (user comment).
TL; DR - user should know that cancel() is non-blocking, and that the way to block on the shutdown is by calling the streaming_pull_future.result() method instead.
Also, at least one of the samples needs to be updated as well, but that's a separate issue.