From 5c3e4fca0e33b92369fc4756c61550193de55f39 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 30 Mar 2020 14:52:30 +0100 Subject: [bookpipeline] Neaten shutdown fix --- cmd/bookpipeline/main.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'cmd') 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) } -- cgit v1.2.1-24-ge1ad