forked from TrueCloudLab/restic
fix compatibility with go 1.19
This commit is contained in:
parent
ff0744b3af
commit
8f8d872a68
2 changed files with 3 additions and 3 deletions
|
@ -333,7 +333,7 @@ type errorOnceBackend struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *errorOnceBackend) Load(ctx context.Context, h backend.Handle, length int, offset int64, consumer func(rd io.Reader) error) error {
|
func (b *errorOnceBackend) Load(ctx context.Context, h backend.Handle, length int, offset int64, consumer func(rd io.Reader) error) error {
|
||||||
_, isRetry := b.m.Swap(h, struct{}{})
|
_, isRetry := b.m.LoadOrStore(h, struct{}{})
|
||||||
return b.Backend.Load(ctx, h, length, offset, func(rd io.Reader) error {
|
return b.Backend.Load(ctx, h, length, offset, func(rd io.Reader) error {
|
||||||
if !isRetry && h.Type != restic.ConfigFile {
|
if !isRetry && h.Type != restic.ConfigFile {
|
||||||
return consumer(errorReadCloser{rd})
|
return consumer(errorReadCloser{rd})
|
||||||
|
|
|
@ -296,8 +296,8 @@ func (be *damageOnceBackend) Load(ctx context.Context, h backend.Handle, length
|
||||||
}
|
}
|
||||||
|
|
||||||
h.IsMetadata = false
|
h.IsMetadata = false
|
||||||
_, retry := be.m.Swap(h, true)
|
_, isRetry := be.m.LoadOrStore(h, true)
|
||||||
if !retry {
|
if !isRetry {
|
||||||
// return broken data on the first try
|
// return broken data on the first try
|
||||||
offset++
|
offset++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue