If a gRPC client starts before the server, it exits with an exception. The application I am working on starts a bunch of servers and clients (near) simultaneously, however, and I have to be robust with respect to execution order. If the client starts before the server, I want it to wait until the server shows up.
I modified the HelloWorld python client example as follows:
done = False
while not done:
try:
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'), timeout=1)
print("Greeter client received: …Run Code Online (Sandbox Code Playgroud)