mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-09-02 07:00:33 +02:00
Merge pull request #831 from PapaYofen/fix-823
Set rpc dial timeout to 5s
This commit is contained in:
commit
fc3c38d0b8
|
@ -40,7 +40,7 @@ func (vs *VolumeServer) doHeartbeat(masterNode string, sleepInterval time.Durati
|
||||||
|
|
||||||
grpcConection, err := util.GrpcDial(masterNode)
|
grpcConection, err := util.GrpcDial(masterNode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("fail to dial: %v", err)
|
return "", fmt.Errorf("fail to dial %s : %v", masterNode, err)
|
||||||
}
|
}
|
||||||
defer grpcConection.Close()
|
defer grpcConection.Close()
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ func NewGrpcServer() *grpc.Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GrpcDial(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
|
func GrpcDial(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||||
|
opts = append(opts, grpc.WithBlock())
|
||||||
|
opts = append(opts, grpc.WithTimeout(time.Duration(5*time.Second)))
|
||||||
opts = append(opts, grpc.WithInsecure())
|
opts = append(opts, grpc.WithInsecure())
|
||||||
opts = append(opts, grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
opts = append(opts, grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
Time: 30 * time.Second, // client ping server if no activity for this long
|
Time: 30 * time.Second, // client ping server if no activity for this long
|
||||||
|
|
Loading…
Reference in a new issue