summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-03-24 17:01:49 +0000
committerNick White <git@njw.name>2020-03-24 17:01:49 +0000
commitdb7ddcb8a383ac40f848cee552eab549ad63269a (patch)
tree8708841002893f2cda9031b83d7024c10992d05b /cmd
parent1d2ef42d31af7904fd46520fa4c6a56dbb8dc4ec (diff)
[bookpipeline] Improve autoshutdown wip
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bookpipeline/main.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/bookpipeline/main.go b/cmd/bookpipeline/main.go
index 032f614..19849ab 100644
--- a/cmd/bookpipeline/main.go
+++ b/cmd/bookpipeline/main.go
@@ -637,6 +637,7 @@ func main() {
noocr := flag.Bool("no", false, "disable ocr")
noocrpg := flag.Bool("nop", false, "disable ocr on individual pages")
noanalyse := flag.Bool("na", false, "disable analysis")
+ autoshutdown := flag.Bool("shutdown", true, "automatically shut down if no work has been available for 5 minutes")
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), usage)
@@ -688,6 +689,9 @@ func main() {
if !*noanalyse {
checkAnalyseQueue = time.After(0)
}
+ if *autoshutdown {
+ shutdownIfQuiet = time.After(TimeBeforeShutdown)
+ }
for {
select {
@@ -779,7 +783,9 @@ func main() {
}
shutdownIfQuiet = time.After(TimeBeforeShutdown)
case <-shutdownIfQuiet:
- log.Println("If I was sufficiently brave, now would be the time I would shut down")
+ if *autoshutdown {
+ log.Println("If I was sufficiently brave, now would be the time I would shut down")
+ }
}
}
}