Skip to content

Commit

Permalink
add missing file count for checking
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Feb 22, 2024
1 parent 3184860 commit 37ca115
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,9 @@ func (cr *Cluster) checkFileFor(
missing *SyncMap[string, *fileInfoWithTargets],
pg *mpb.Progress,
) {
var missingCount atomic.Int32
addMissing := func(f FileInfo) {
missingCount.Add(1)
if info, has := missing.GetOrSet(f.Hash, func() *fileInfoWithTargets {
return &fileInfoWithTargets{
FileInfo: f,
Expand Down Expand Up @@ -805,7 +807,7 @@ func (cr *Cluster) checkFileFor(
checkingHash = ""
checkingHashMux.Unlock()

logInfof("File check finished for %s", storage.String())
logInfof("File check finished for %s, missing %d files", storage.String(), missingCount.Load())
return
}

Expand Down Expand Up @@ -925,7 +927,7 @@ func (cr *Cluster) syncFiles(ctx context.Context, files []FileInfo, heavyCheck b
}
err := target.Create(f.Hash, srcFd)
if err != nil {
logErrorf("Could not create %s: %v", target.String(), err)
logErrorf("Could not create %s/%s: %v", target.String(), f.Hash, err)
continue
}
}
Expand Down

0 comments on commit 37ca115

Please sign in to comment.