summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-08-22 10:23:56 +0100
committerNick White <git@njw.name>2019-08-22 10:27:53 +0100
commit24763c95d26535b093476b1c6b21dcbceb1ff55c (patch)
tree228309ed692102627c74d4a2c2f6243aac18c1e2
parentbdedc2ca1e6fbcbc06cd124f1729a341bc13afe8 (diff)
Improve timing of queue checks
Now each queue is checked every 3 minutes, though the channel for each queue check request won't be rechecked until any previous job is completed.
-rw-r--r--pipelinepreprocess/main.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/pipelinepreprocess/main.go b/pipelinepreprocess/main.go
index 029ac76..f53aac0 100644
--- a/pipelinepreprocess/main.go
+++ b/pipelinepreprocess/main.go
@@ -25,7 +25,7 @@ func (w NullWriter) Write(p []byte) (n int, err error) {
return len(p), nil
}
-const PauseBetweenChecks = 60 * time.Second
+const PauseBetweenChecks = 3 * time.Minute
type Clouder interface {
Init() error
@@ -293,38 +293,34 @@ func main() {
select {
case <- checkPreQueue:
msg, err := conn.CheckPreQueue()
+ checkPreQueue = time.After(PauseBetweenChecks)
if err != nil {
log.Println("Error checking preprocess queue", err)
- checkPreQueue = time.After(PauseBetweenChecks)
continue
}
if msg.Handle == "" {
verboselog.Println("No message received on preprocess queue, sleeping")
- checkPreQueue = time.After(PauseBetweenChecks)
continue
}
err = preProcBook(msg, conn)
if err != nil {
log.Println("Error during preprocess", err)
}
- checkPreQueue = time.After(0)
case <- checkOCRQueue:
msg, err := conn.CheckOCRQueue()
+ checkOCRQueue = time.After(PauseBetweenChecks)
if err != nil {
log.Println("Error checking OCR queue", err)
- checkOCRQueue = time.After(PauseBetweenChecks)
continue
}
if msg.Handle == "" {
verboselog.Println("No message received on OCR queue, sleeping")
- checkOCRQueue = time.After(PauseBetweenChecks)
continue
}
err = ocrBook(msg, conn)
if err != nil {
log.Println("Error during OCR process", err)
}
- checkOCRQueue = time.After(0)
}
}
}