mirror of
https://github.com/restic/restic.git
synced 2026-10-08 03:17:12 +00:00
Retry failed backend requests
This commit is contained in:
1 parent
67193e3deb
commit
897c923cc9
3 files changed
+155
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic/internal/backend"
|
||||
"github.com/restic/restic/internal/backend/azure"
|
||||
@@ -328,6 +329,10 @@ func OpenRepository(opts GlobalOptions) (*repository.Repository, error) {
|
||||
be = limiter.LimitBackend(be, limiter.NewStaticLimiter(opts.LimitUploadKb, opts.LimitDownloadKb))
|
||||
}
|
||||
|
||||
be = backend.NewRetryBackend(be, 10, func(msg string, err error, d time.Duration) {
|
||||
Warnf("%v returned error, retrying after %v: %v\n", msg, d, err)
|
||||
})
|
||||
|
||||
s := repository.New(be)
|
||||
|
||||
opts.password, err = ReadPassword(opts, "enter password for repository: ")
|
||||
|
||||
Reference in new issue
Block a user