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) }