aboutsummaryrefslogtreecommitdiff
path: root/weed/command/s3.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-02-26 16:49:47 -0800
committerChris Lu <chris.lu@gmail.com>2020-02-26 16:49:47 -0800
commit556dd76303dd95eb2cfac9e27fc59b0a999a57e6 (patch)
tree4a100644ba0e04c1b7db21a779725dadf62d5642 /weed/command/s3.go
parentc4de81434711c6734d8dacef14ad5dfa45977d70 (diff)
downloadseaweedfs-556dd76303dd95eb2cfac9e27fc59b0a999a57e6.tar.xz
seaweedfs-556dd76303dd95eb2cfac9e27fc59b0a999a57e6.zip
s3: wait to connect to filer
Diffstat (limited to 'weed/command/s3.go')
-rw-r--r--weed/command/s3.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/weed/command/s3.go b/weed/command/s3.go
index 9e8236a83..39d0c04fc 100644
--- a/weed/command/s3.go
+++ b/weed/command/s3.go
@@ -127,18 +127,23 @@ func (s3opt *S3Options) startS3Server() bool {
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
- err = withFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
- resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
+ for {
+ err = withFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
+ resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
+ if err != nil {
+ return fmt.Errorf("get filer %s configuration: %v", filerGrpcAddress, err)
+ }
+ filerBucketsPath = resp.DirBuckets
+ glog.V(0).Infof("S3 read filer buckets dir: %s", filerBucketsPath)
+ return nil
+ })
if err != nil {
- return fmt.Errorf("get filer %s configuration: %v", filerGrpcAddress, err)
+ glog.V(0).Infof("wait to connect to filer %s grpc address %s", *s3opt.filer, filerGrpcAddress)
+ time.Sleep(time.Second)
+ } else {
+ glog.V(0).Infof("connected to filer %s grpc address %s", *s3opt.filer, filerGrpcAddress)
+ break
}
- filerBucketsPath = resp.DirBuckets
- glog.V(0).Infof("S3 read filer buckets dir: %s", filerBucketsPath)
- return nil
- })
- if err != nil {
- glog.Fatal(err)
- return false
}
router := mux.NewRouter().SkipClean(true)