added tesseract threads

This commit is contained in:
ston1th 2019-05-05 21:07:34 +02:00
commit 84d48a6eea
4 changed files with 41 additions and 21 deletions

View file

@ -29,7 +29,8 @@ const (
defRunUser = "docstore"
defRunGroup = "docstore"
defTimeout = 600
defTimeout = 600
tesseractThreads = 1
)
var (
@ -71,8 +72,11 @@ func initServer(cfg core.Config) (err error) {
log.InitLogger(cfg)
cfg.DataDir = filepath.Join(cfg.RunDir, core.DataDir)
debugCfg := cfg
debugCfg.Secret = "***hidden***"
log.Debugf("docstore config: %+v", debugCfg)
scanner, err := scan.New(cfg.DataDir, cfg.Langs, time.Second*time.Duration(cfg.CMDTimeout))
scanner, err := scan.New(cfg.DataDir, cfg.Langs, cfg.TesseractThreads, time.Second*time.Duration(cfg.CMDTimeout))
if err != nil {
return errors.New("scanner: " + err.Error())
}
@ -255,6 +259,12 @@ func serverFlags() []cli.Flag {
Usage: "timeout in seconds for executed teseract and pdftotext commands",
Destination: &config.CMDTimeout,
},
cli.IntFlag{
Name: "threads",
Value: tesseractThreads,
Usage: "tesseract thread limit (1-4)",
Destination: &config.TesseractThreads,
},
cli.BoolFlag{
Name: "foreground, f",
Usage: "do not fork into the background",