From 05d27741179b199608d0c5c5373bf3c8939c1697 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 28 Aug 2021 19:48:51 -0700 Subject: [PATCH] refactoring --- weed/command/filer_remote_sync.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/weed/command/filer_remote_sync.go b/weed/command/filer_remote_sync.go index db5ce8b90..48713093e 100644 --- a/weed/command/filer_remote_sync.go +++ b/weed/command/filer_remote_sync.go @@ -73,13 +73,6 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool { dir := *remoteSyncOptions.dir filerAddress := *remoteSyncOptions.filerAddress - // read filer remote storage mount mappings - _, _, remoteStorageMountLocation, storageConf, detectErr := filer.DetectMountInfo(grpcDialOption, filerAddress, dir) - if detectErr != nil { - fmt.Printf("read mount info: %v", detectErr) - return false - } - filerSource := &source.FilerSource{} filerSource.DoInitialize( filerAddress, @@ -90,7 +83,7 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool { fmt.Printf("synchronize %s to remote storage...\n", dir) util.RetryForever("filer.remote.sync "+dir, func() error { - return followUpdatesAndUploadToRemote(&remoteSyncOptions, filerSource, dir, storageConf, remoteStorageMountLocation) + return followUpdatesAndUploadToRemote(&remoteSyncOptions, filerSource, dir) }, func(err error) bool { if err != nil { glog.Errorf("synchronize %s: %v", dir, err) @@ -101,7 +94,13 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool { return true } -func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *source.FilerSource, mountedDir string, remoteStorage *remote_pb.RemoteConf, remoteStorageMountLocation *remote_pb.RemoteStorageLocation) error { +func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *source.FilerSource, mountedDir string) error { + + // read filer remote storage mount mappings + _, _, remoteStorageMountLocation, remoteStorage, detectErr := filer.DetectMountInfo(option.grpcDialOption, *option.filerAddress, mountedDir) + if detectErr != nil { + return fmt.Errorf("read mount info: %v", detectErr) + } dirHash := util.HashStringToLong(mountedDir)