MCPcopy
hub / github.com/rclone/rclone / retryFastCopy

Method retryFastCopy

cmd/bisync/queue.go:266–289  ·  view source on GitHub ↗
(ctx context.Context, fsrc, fdst fs.Fs, files bilib.Names, queueName string, results []Results, err error)

Source from the content-addressed store, hash-verified

264}
265
266func (b *bisyncRun) retryFastCopy(ctx context.Context, fsrc, fdst fs.Fs, files bilib.Names, queueName string, results []Results, err error) ([]Results, error) {
267 ci := fs.GetConfig(ctx)
268 if err != nil && b.opt.Resilient && !b.InGracefulShutdown && ci.Retries > 1 {
269 for tries := 1; tries <= ci.Retries; tries++ {
270 fs.Logf(queueName, Color(terminal.YellowFg, "Received error: %v - retrying as --resilient is set. Retry %d/%d"), err, tries, ci.Retries)
271 accounting.GlobalStats().ResetErrors()
272 if retryAfter := accounting.GlobalStats().RetryAfter(); !retryAfter.IsZero() {
273 d := time.Until(retryAfter)
274 if d > 0 {
275 fs.Logf(nil, "Received retry after error - sleeping until %s (%v)", retryAfter.Format(time.RFC3339Nano), d)
276 time.Sleep(d)
277 }
278 }
279 if ci.RetriesInterval > 0 {
280 naptime(ci.RetriesInterval)
281 }
282 results, err = b.fastCopy(ctx, fsrc, fdst, files, queueName)
283 if err == nil || b.InGracefulShutdown {
284 return results, err
285 }
286 }
287 }
288 return results, err
289}
290
291func (b *bisyncRun) resyncDir(ctx context.Context, fsrc, fdst fs.Fs) ([]Results, error) {
292 ctx = b.preCopy(ctx)

Callers 1

applyDeltasMethod · 0.95

Calls 10

fastCopyMethod · 0.95
GetConfigFunction · 0.92
LogfFunction · 0.92
GlobalStatsFunction · 0.92
ColorFunction · 0.85
naptimeFunction · 0.85
ResetErrorsMethod · 0.80
IsZeroMethod · 0.80
FormatMethod · 0.80
RetryAfterMethod · 0.65

Tested by

no test coverage detected