简体   繁体   中英

How to set environment variables for GRPC on windows

gRPC uses an exponential backoff algorithm on failed connections: read more here

Also, for C-based gRPC implementations environment variables are used to configure gRPC behavior. I'm running on windows and trying to view and change those environment variables. For example, I'd like to view and change INITIAL_BACKOFF. Now, on windows I can do a do 'set' inside cmd.exe and see environment variables, INITIAL_BACKOFF is not in there. Also, I've looked in regedit for INITIAL_BACKOFF and could not find it there. I've also tried using python at at runtime using os.getenviron('INITIAL_BACKOFF') which returns None. Either the environment variable is not truly INITIAL_BACKOFF on windows, or the way in which I'm accessing it is not correct. Which is it?

in python gRPC documentation it shows that when setting up a client with insecure_channel or secure_channel that options can be passed , but nowhere does it actually say what the options are. The options should be a list of two-tuples. Each tuple should consist of an environment variable and its corresponding value. Options are here

options = [('grpc.max_reconnect_backoff_ms', 100)] # 100 milliseconds 
channel = grpc.insecure_channel('localhost:50051', options=options)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM