Thanks Ken, that looks useful!

On Friday, 18 August 2017 16:37:17 UTC+1, Ken Payson wrote:
>
> There are a few ways to track channel state in Python. If you only want to 
> block until it is connected, try
>
> grpc.channel_ready_future(channel).result()
>
> https://grpc.io/grpc/python/grpc.html#grpc.channel_ready_future
>
>
> On Fri, Aug 18, 2017 at 7:23 AM, Julian Gold <[email protected] 
> <javascript:>> wrote:
>
>> I am working on an architecture with a single client and multiple 
>> servers. GRPC raises an exception if the client starts without a server 
>> present, so I tried modifying the HelloWorld sample to wait until a call 
>> succeeds:
>>
>>   done = False
>>   while not done:
>>       try:
>>           response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'
>> ), timeout=1)
>>           print("Greeter client received: " + response.message)
>>           done = True
>>       except:
>>           print('Waiting for server connect...')
>>           time.sleep(1)
>>
>>
>> Strangely, though this works, it takes quite a while to connect when the 
>> server is started after the client (about 10 seconds or more) before 
>> showing the result. A quick internet search shows there is a WaitForReady 
>> option in C#, but there doesn't seem to be an equivalent in Python? How 
>> else can I check if a connection is ready?
>>
>>
>>     
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "grpc.io" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/grpc-io.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/grpc-io/a2f41bce-007a-4adb-8032-1ea3af6c5100%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/grpc-io/a2f41bce-007a-4adb-8032-1ea3af6c5100%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/d441fcf0-640c-43d5-9e8a-d29462731d6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to