1
0
mirror of https://github.com/fumiama/dupimage.git synced 2026-06-27 07:30:28 +08:00

优化并发

This commit is contained in:
源文雨
2022-07-26 15:22:37 +08:00
parent 4fb796cea5
commit 0ec4522bee

View File

@@ -90,15 +90,14 @@ func main() {
continue continue
} }
im, _, err := image.Decode(f) im, _, err := image.Decode(f)
_ = f.Close()
if err != nil { if err != nil {
fmt.Println("ERROR:", err) fmt.Println("ERROR:", err)
_ = f.Close()
continue continue
} }
dh, err := goimagehash.DifferenceHash(im) dh, err := goimagehash.DifferenceHash(im)
if err != nil { if err != nil {
fmt.Println("ERROR:", err) fmt.Println("ERROR:", err)
_ = f.Close()
continue continue
} }
mu.Lock() mu.Lock()
@@ -108,7 +107,6 @@ func main() {
}) })
fmt.Print("read: ", len(chklst), " / ", len(imgs), "\r") fmt.Print("read: ", len(chklst), " / ", len(imgs), "\r")
mu.Unlock() mu.Unlock()
_ = f.Close()
} }
} }
wg.Done() wg.Done()