Notable Implementation Changes
- In subscription consumer thread: Making sure the request generator
attached to an inactive bidirectional streaming pull is stopped before
spawning a new request generator. This way we have a (fairly strong)
guarantee that requests in the queue don't get sent into an inactive
stream (#4503, #4554). - Adding
pause
/resume
to subscription consumer thread and using these
methods during flow control. The previous implementation tried to close the
subscription (which involved 3 worker threads and 10 executors in a thread
pool) and then re-open a new subscription. But, this was not entirely
possible to shut down correctly from within one of the worker threads.
Instead, we only pause the worker (of the 3) that is pulling new responses
from the bidirectional streaming pull (#4558). - Bug fix (#4516): Using
max
wheremin
was used by mistake to
ensure the number of bytes tracked for subscription flow control
remained non-negative (#4514). - Raising
TypeError
ifSubscriberClient.subscribe
receives a
non-callable callback (#4497). - Shutting down thread pool executor when closing a subscriber
policy (#4522). - Renaming
Policy.on_callback_request
toPolicy.dispatch_callback
and making the behavior much less dynamic (#4511). - Make sure subscription consumer thread doesn't try to join itself
when exiting in error (#4540).