Update condition for safe md5 check

This commit is contained in:
2025-09-02 22:12:30 +07:00
parent c26ecf70fe
commit 4d9310bc35
3 changed files with 8 additions and 14 deletions

View File

@@ -16,18 +16,18 @@ type HdiffFile struct {
}
func MakeHdiffFile(oldPath string, newPath string, changedFiles []string) error {
delFile, err := os.Create("hdiff/hdifffiles.txt")
diffFile, err := os.Create("hdiff/hdifffiles.txt")
if err != nil {
return err
}
defer delFile.Close()
defer diffFile.Close()
for _, f := range changedFiles {
data, err := json.Marshal(HdiffFile{RemoteName: f})
if err != nil {
return err
}
fmt.Fprintln(delFile, string(data))
fmt.Fprintln(diffFile, string(data))
}
bar := progressbar.NewOptions(len(changedFiles),
@@ -37,10 +37,8 @@ func MakeHdiffFile(oldPath string, newPath string, changedFiles []string) error
progressbar.OptionSetPredictTime(true),
)
workers := runtime.NumCPU() / 2
if workers < 2 {
workers = 2
}
workers := runtime.NumCPU()
jobs := make(chan string, len(changedFiles))
var wg sync.WaitGroup