mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-04 23:55:22 +00:00
parent
977ee4f06b
commit
14ae330eff
@ -10,6 +10,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
@ -822,6 +823,7 @@ func (db *Lowlevel) getMetaAndCheck(folder string) *metadataTracker {
|
|||||||
var fixed int
|
var fixed int
|
||||||
fixed, err = db.checkLocalNeed([]byte(folder))
|
fixed, err = db.checkLocalNeed([]byte(folder))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = fmt.Errorf("checking local need: %w", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if fixed != 0 {
|
if fixed != 0 {
|
||||||
@ -830,11 +832,13 @@ func (db *Lowlevel) getMetaAndCheck(folder string) *metadataTracker {
|
|||||||
|
|
||||||
meta, err := db.recalcMeta(folder)
|
meta, err := db.recalcMeta(folder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = fmt.Errorf("recalculating metadata: %w", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed, err = db.repairSequenceGCLocked(folder, meta)
|
fixed, err = db.repairSequenceGCLocked(folder, meta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = fmt.Errorf("repairing sequences: %w", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if fixed != 0 {
|
if fixed != 0 {
|
||||||
@ -1094,7 +1098,7 @@ func (db *Lowlevel) checkLocalNeed(folder []byte) (int, error) {
|
|||||||
f := fi.(FileInfoTruncated)
|
f := fi.(FileInfoTruncated)
|
||||||
for !needDone && needName < f.Name {
|
for !needDone && needName < f.Name {
|
||||||
repaired++
|
repaired++
|
||||||
if err = t.Delete(dbi.Key()); err != nil {
|
if err = t.Delete(dbi.Key()); err != nil && !backend.IsNotFound(err) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
l.Debugln("check local need: removing", needName)
|
l.Debugln("check local need: removing", needName)
|
||||||
@ -1121,7 +1125,7 @@ func (db *Lowlevel) checkLocalNeed(folder []byte) (int, error) {
|
|||||||
|
|
||||||
for !needDone {
|
for !needDone {
|
||||||
repaired++
|
repaired++
|
||||||
if err := t.Delete(dbi.Key()); err != nil {
|
if err := t.Delete(dbi.Key()); err != nil && !backend.IsNotFound(err) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
l.Debugln("check local need: removing", needName)
|
l.Debugln("check local need: removing", needName)
|
||||||
|
Loading…
Reference in New Issue
Block a user