Closed bruce1125 closed 4 months ago
Hey @bruce1125 , what are you trying to achieve exactly? The timeout for the RPCs can already be configured via "pitaya.cluster.rpc.client.grpc.requesttimeout" or "pitaya.cluster.rpc.client.nats.requesttimeout" config options :)
Hey @bruce1125 , what are you trying to achieve exactly? The timeout for the RPCs can already be configured via "pitaya.cluster.rpc.client.grpc.requesttimeout" or "pitaya.cluster.rpc.client.nats.requesttimeout" config options :)
Thank you for review. Although we can configure the grpc/nats timeout, that is global. It can cover most of cases excluding some time-consuming operations, such as getting an external API response, collecting a cpu/memory snapshot, etc. And I don't want to set the timeout value only for these issues..
@bruce1125 would appreciate if you could update the docs later covering this new capability
To customize the timeout value, the only thing we need to do is just like the code below before RPC call and then use the ctx as the context argument:
ctx := pcontext.AddToPropagateCtx(context.Background(), constants.RequestTimeout, (60 * time.Second).String())