mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 Tesseract OCR 加锁串行执行提升稳定性 Fix https://github.com/siyuan-note/siyuan/issues/7265
This commit is contained in:
parent
a3444452aa
commit
9404330f23
2 changed files with 8 additions and 22 deletions
|
|
@ -64,12 +64,17 @@ func IsTesseractExtractable(p string) bool {
|
|||
return strings.HasSuffix(lowerName, ".png") || strings.HasSuffix(lowerName, ".jpg") || strings.HasSuffix(lowerName, ".jpeg")
|
||||
}
|
||||
|
||||
// tesseractOCRLock 用于 Tesseract OCR 加锁串行执行提升稳定性 https://github.com/siyuan-note/siyuan/issues/7265
|
||||
var tesseractOCRLock = sync.Mutex{}
|
||||
|
||||
func Tesseract(imgAbsPath string) string {
|
||||
if ContainerStd != Container || !TesseractEnabled {
|
||||
return ""
|
||||
}
|
||||
|
||||
defer logging.Recover()
|
||||
tesseractOCRLock.Lock()
|
||||
defer tesseractOCRLock.Unlock()
|
||||
|
||||
if !IsTesseractExtractable(imgAbsPath) {
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue