mirror of
https://github.com/fumiama/dupimage.git
synced 2026-06-27 07:30:28 +08:00
优化并发
This commit is contained in:
4
main.go
4
main.go
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user