"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
bisync: use global --retries and --retries-sleep flags instead of overriding
nielashf4c058e13e3b
diff --git a/cmd/bisync/cmd.go b/cmd/bisync/cmd.goindex e50ae9e16..22a600923 100644--- a/cmd/bisync/cmd.go+++ b/cmd/bisync/cmd.go@@ -51,8 +51,6 @@ type Options struct {Resilient boolRecover boolTestFn TestFunc // test-only option, for mocking errors- Retries int- RetriesInterval time.DurationCompare CompareOptCompareFlag stringDebugName string@@ -119,7 +117,6 @@ func (x *CheckSyncMode) Type() string {var Opt Optionsfunc init() {- Opt.Retries = 3Opt.MaxLock = 0cmd.Root.AddCommand(commandDefinition)cmdFlags := commandDefinition.Flags()@@ -144,8 +141,6 @@ func init() {flags.BoolVarP(cmdFlags, &Opt.IgnoreListingChecksum, "ignore-listing-checksum", "", Opt.IgnoreListingChecksum, "Do not use checksums for listings (add --ignore-checksum to additionally skip post-copy checksum checks)", "")flags.BoolVarP(cmdFlags, &Opt.Resilient, "resilient", "", Opt.Resilient, "Allow future runs to retry after certain less-serious errors, instead of requiring --resync. Use at your own risk!", "")flags.BoolVarP(cmdFlags, &Opt.Recover, "recover", "", Opt.Recover, "Automatically recover from interruptions without requiring --resync.", "")- flags.IntVarP(cmdFlags, &Opt.Retries, "retries", "", Opt.Retries, "Retry operations this many times if they fail (requires --resilient).", "")- flags.DurationVarP(cmdFlags, &Opt.RetriesInterval, "retries-sleep", "", 0, "Interval between retrying operations if they fail, e.g. 500ms, 60s, 5m (0 to disable)", "")flags.StringVarP(cmdFlags, &Opt.CompareFlag, "compare", "", Opt.CompareFlag, "Comma-separated list of bisync-specific compare options ex. 'size,modtime,checksum' (default: 'size,modtime')", "")flags.BoolVarP(cmdFlags, &Opt.Compare.NoSlowHash, "no-slow-hash", "", Opt.Compare.NoSlowHash, "Ignore listing checksums only on backends where they are slow", "")flags.BoolVarP(cmdFlags, &Opt.Compare.SlowHashSyncOnly, "slow-hash-sync-only", "", Opt.Compare.SlowHashSyncOnly, "Ignore slow checksums for listings and deltas, but still consider them during sync calls.", "")diff --git a/cmd/bisync/queue.go b/cmd/bisync/queue.goindex bdd85b665..f5617ed8a 100644--- a/cmd/bisync/queue.go+++ b/cmd/bisync/queue.go@@ -51,13 +51,15 @@ func (rs *ResultsSlice) has(name string) bool {return false}-var logger = operations.NewLoggerOpt()-var lock mutex.Mutex-var once mutex.Once-var ignoreListingChecksum bool-var ignoreListingModtime bool-var hashTypes map[string]hash.Type-var queueCI *fs.ConfigInfo+var (+ logger = operations.NewLoggerOpt()+ lock mutex.Mutex+ once mutex.Once+ ignoreListingChecksum bool+ ignoreListingModtime bool+ hashTypes map[string]hash.Type+ queueCI *fs.ConfigInfo+)// allows us to get the right hashtype during the LoggerFn without knowing whether it's Path1/Path2func getHashType(fname string) hash.Type {@@ -262,9 +264,10 @@ func (b *bisyncRun) fastCopy(ctx context.Context, fsrc, fdst fs.Fs, files bilib.}func (b *bisyncRun) retryFastCopy(ctx context.Context, fsrc, fdst fs.Fs, files bilib.Names, queueName string, results []Results, err error) ([]Results, error) {- if err != nil && b.opt.Resilient && !b.InGracefulShutdown && b.opt.Retries > 1 {- for tries := 1; tries <= b.opt.Retries; tries++ {- fs.Logf(queueName, Color(terminal.YellowFg, "Received error: %v - retrying as --resilient is set. Retry %d/%d"), err, tries, b.opt.Retries)+ ci := fs.GetConfig(ctx)+ if err != nil && b.opt.Resilient && !b.InGracefulShutdown && ci.Retries > 1 {+ for tries := 1; tries <= ci.Retries; tries++ {+ fs.Logf(queueName, Color(terminal.YellowFg, "Received error: %v - retrying as --resilient is set. Retry %d/%d"), err, tries, ci.Retries)accounting.GlobalStats().ResetErrors()if retryAfter := accounting.GlobalStats().RetryAfter(); !retryAfter.IsZero() {d := time.Until(retryAfter)@@ -273,8 +276,8 @@ func (b *bisyncRun) retryFastCopy(ctx context.Context, fsrc, fdst fs.Fs, files btime.Sleep(d)}}- if b.opt.RetriesInterval > 0 {- naptime(b.opt.RetriesInterval)+ if ci.RetriesInterval > 0 {+ naptime(ci.RetriesInterval)}results, err = b.fastCopy(ctx, fsrc, fdst, files, queueName)if err == nil || b.InGracefulShutdown {@@ -313,7 +316,7 @@ func (b *bisyncRun) syncEmptyDirs(ctx context.Context, dst fs.Fs, candidates bilfor _, s := range candidatesList {var direrr error- if dirsList.has(s) { //make sure it's a dir, not a file+ if dirsList.has(s) { // make sure it's a dir, not a filer := Results{}r.Name = sr.Size = -1