Does RPC have a timeout mechanism?

前端 未结 4 613
情书的邮戳
情书的邮戳 2021-02-09 14:30

If RPC does not have a timeout mechanism, how do I \"kill\" an RPC call if it is trying to call an RPC method of a server that is closed?

4条回答
  •  生来不讨喜
    2021-02-09 15:15

    It seems the only solution for net/rpc is to close the underlying connection when you notice stuck requests. Then the client should finish pending requests with "connection broken" errors.

    An alternative way is to use https://github.com/valyala/gorpc , which supports timeout RPC calls out of the box.

提交回复
热议问题