summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-03-30 14:52:30 +0100
committerNick White <git@njw.name>2020-03-30 14:52:30 +0100
commit5c3e4fca0e33b92369fc4756c61550193de55f39 (patch)
treec72c928c2c8b701be9dffa7a8979e7ceff47ad07
parent52903b8dd02ca94b12dfb837ae0b7f5087361b6d (diff)
[bookpipeline] Neaten shutdown fix
-rw-r--r--cmd/bookpipeline/main.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/cmd/bookpipeline/main.go b/cmd/bookpipeline/main.go
index daa6ab9..8317f3b 100644
--- a/cmd/bookpipeline/main.go
+++ b/cmd/bookpipeline/main.go
@@ -635,13 +635,6 @@ func stopTimer(t *time.Timer) {
}
}
-func restartTimer(t *time.Timer) {
- //if !t.Stop() {
- // <-t.C
- //}
- t.Reset(TimeBeforeShutdown)
-}
-
func main() {
verbose := flag.Bool("v", false, "verbose")
training := flag.String("t", "rescribealphav5", "default tesseract training file to use (without the .traineddata part)")
@@ -722,7 +715,7 @@ func main() {
verboselog.Println("Message received on preprocess queue, processing", msg.Body)
stopTimer(shutdownIfQuiet)
err = processBook(msg, conn, preprocess, origPattern, conn.PreQueueId(), conn.OCRPageQueueId())
- restartTimer(shutdownIfQuiet)
+ shutdownIfQuiet.Reset(TimeBeforeShutdown)
if err != nil {
log.Println("Error during preprocess", err)
}
@@ -740,7 +733,7 @@ func main() {
stopTimer(shutdownIfQuiet)
verboselog.Println("Message received on wipeonly queue, processing", msg.Body)
err = processBook(msg, conn, wipe, wipePattern, conn.WipeQueueId(), conn.OCRPageQueueId())
- restartTimer(shutdownIfQuiet)
+ shutdownIfQuiet.Reset(TimeBeforeShutdown)
if err != nil {
log.Println("Error during wipe", err)
}
@@ -760,7 +753,7 @@ func main() {
stopTimer(shutdownIfQuiet)
verboselog.Println("Message received on OCR Page queue, processing", msg.Body)
err = ocrPage(msg, conn, ocr(*training), conn.OCRPageQueueId(), conn.AnalyseQueueId())
- restartTimer(shutdownIfQuiet)
+ shutdownIfQuiet.Reset(TimeBeforeShutdown)
if err != nil {
log.Println("Error during OCR Page process", err)
}
@@ -778,7 +771,7 @@ func main() {
stopTimer(shutdownIfQuiet)
verboselog.Println("Message received on OCR queue, processing", msg.Body)
err = processBook(msg, conn, ocr(*training), preprocessedPattern, conn.OCRQueueId(), conn.AnalyseQueueId())
- restartTimer(shutdownIfQuiet)
+ shutdownIfQuiet.Reset(TimeBeforeShutdown)
if err != nil {
log.Println("Error during OCR process", err)
}
@@ -796,7 +789,7 @@ func main() {
stopTimer(shutdownIfQuiet)
verboselog.Println("Message received on analyse queue, processing", msg.Body)
err = processBook(msg, conn, analyse(conn), ocredPattern, conn.AnalyseQueueId(), "")
- restartTimer(shutdownIfQuiet)
+ shutdownIfQuiet.Reset(TimeBeforeShutdown)
if err != nil {
log.Println("Error during analysis", err)
}