go micro web端连接services时,第一次访问提示500(broken pipe),排查发现客户端请求services时返回

 {"id":"go.micro.client","code":408,"detail":"call timeout: context deadline exceeded","status":"Request Timeout"}

修改micro client超时时间后没再出现过这种情况,待跟踪

具体修改:

#service增加CallOption并设置超时时间
var opss client.CallOption = func(o *client.CallOptions) {
    o.RequestTimeout = time.Second * 30
    o.DialTimeout = time.Second * 30
}

func (VipService) GetTotalCash() (*vip.CashResponse, error) {
    return VipSrv.GetTotalCash(context.TODO(), &vip.CashRequest{}, opss)
}

 

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2021-07-01
  • 2021-10-06
  • 2021-07-11
  • 2021-05-28
  • 2021-11-26
猜你喜欢
  • 2022-02-27
  • 2022-12-23
  • 2021-10-28
  • 2021-08-28
  • 2022-12-23
  • 2021-10-30
相关资源
相似解决方案