From b8533faf24f2bf5247f28848459f9b7af77e61b3 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 12 Jul 2021 16:47:09 +0100 Subject: Add test for upAndQueue function This involved adding a test queue, so it can be run safely without intefering with the pipeline. --- internal/pipeline/pipeline.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'internal/pipeline/pipeline.go') diff --git a/internal/pipeline/pipeline.go b/internal/pipeline/pipeline.go index 3836204..3419f74 100644 --- a/internal/pipeline/pipeline.go +++ b/internal/pipeline/pipeline.go @@ -48,6 +48,7 @@ type Pipeliner interface { WipeQueueId() string OCRPageQueueId() string AnalyseQueueId() string + TestQueueId() string WIPStorageId() string GetLogger() *log.Logger Log(v ...interface{}) @@ -129,6 +130,12 @@ func up(c chan string, done chan bool, conn Pipeliner, bookname string, errc cha done <- true } +// upAndQueue reads file names from a channel and uploads them with +// the bookname/ prefix, removing the local copy of each file +// once it has been successfully uploaded. Each done file name is +// added to the toQueue once it has been uploaded. The done channel +// is then written to to signal completion. If an error occurs it +// is sent to the errc channel and the function returns early. func upAndQueue(c chan string, done chan bool, toQueue string, conn Pipeliner, bookname string, training string, errc chan error, logger *log.Logger) { for path := range c { name := filepath.Base(path) -- cgit v1.2.1-24-ge1ad