Add Capability to Override Base Timeout for Specific API

Author: AdityagaddhyanCreated Mar 11, 2024Updated Mar 13, 2024

Feature Request: Add Capability to Override Base Timeout for Specific API

I would like to propose a feature that allows us to override the base timeout for a specific API. This would be beneficial in scenarios where certain APIs are expected to take more time, eliminating the need to adjust the timeout for the entire gRPC client.

Proposal:

A possible implementation could involve exposing a method to add a CallOption. We can then adjust timeout.UnaryClientInterceptor to first iterate over the options. If it identifies a specific CallOption for timeout, it would set the context's deadline equal to what's specified in the CallOption, rather than using the global timeout set for the Server.

This feature would mainly enhance the client side experience by offering more flexibility and control over API timeouts.

Looking forward to hearing your thoughts on this proposal.

Source: grpc-ecosystem/go-grpc-middleware