I am listening in a python thread on a gRPC stream that never ends:
responses = some_grpc_stub.FunctionThatReturnsStream()
for response in responses:
on_event(response)
I want to do this for a while, and then stop listening, so that on_event isn't called again, possibly before the stream is done.
How do I do that? Is there a correct way to just kill the thread in which this loop is running? Or is there some way to have responses end prematurely so iteration ends and the thread can run to completion?