aboutsummaryrefslogtreecommitdiff
path: root/weed/wdclient/masterclient.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-04-22 18:26:24 -0700
committerChris Lu <chris.lu@gmail.com>2020-04-22 18:26:24 -0700
commitaebe39a80388e699ca9b210929159d9d9d552b29 (patch)
treef559e02c8870fc8b310885c421a1edd69b561242 /weed/wdclient/masterclient.go
parent5d0e1d8d741b93c8f77b6ff709b5079580c7dda6 (diff)
downloadseaweedfs-aebe39a80388e699ca9b210929159d9d9d552b29.tar.xz
seaweedfs-aebe39a80388e699ca9b210929159d9d9d552b29.zip
avoid repeated grpc connection creation
fix https://github.com/chrislusf/seaweedfs/issues/1277
Diffstat (limited to 'weed/wdclient/masterclient.go')
-rw-r--r--weed/wdclient/masterclient.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go
index f73853c78..4f8e0d5ef 100644
--- a/weed/wdclient/masterclient.go
+++ b/weed/wdclient/masterclient.go
@@ -121,6 +121,9 @@ func (mc *MasterClient) tryConnectToMaster(master string) (nextHintedLeader stri
}
func (mc *MasterClient) WithClient(fn func(client master_pb.SeaweedClient) error) error {
+ for mc.currentMaster == "" {
+ time.Sleep(3 * time.Second)
+ }
return pb.WithMasterClient(mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
return fn(client)
})