Search code examples
gogrpcgrpc-gateway

How to set a timeout in grpc-gateway?


How to set a timeout in grpc-gateway?
I want to limit the time the request is executed, where can I set a time limit? Do I need to create an "Interceptor" for this?


Solution

  • Once again I looked through the source code and found the variable in which you can set the default waiting time

    runtime.DefaultContextTimeout = 10 * time.Second
    

    Link to source code