This commit is contained in:
Daniel 2023-08-27 17:46:06 +08:00
parent 0ec9a28763
commit 06f6534402
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -774,6 +774,10 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
// initialize go-pdfium with number of available cores
// we fire up the complete worker pool for maximum performance
cores := runtime.NumCPU()
if 4 < cores {
cores = 4 // Limit memory usage
}
pool, err := webassembly.Init(webassembly.Config{
MinIdle: cores,
MaxIdle: cores,
@ -853,7 +857,7 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
close(results)
if 128 < pc.PageCount {
logging.LogInfof("convert [%s] PDF with [%d[ pages using [%d] workers took [%s]", absPath, pc.PageCount, cores, time.Since(now))
logging.LogInfof("convert [%s] PDF with [%d] pages using [%d] workers took [%s]", absPath, pc.PageCount, cores, time.Since(now))
}
// loop through ordered PDF text pages and join content for asset parse DB result