diff options
author | Nick White <git@njw.name> | 2021-07-12 16:47:09 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2021-07-12 16:47:09 +0100 |
commit | b8533faf24f2bf5247f28848459f9b7af77e61b3 (patch) | |
tree | ddfc1e1382f3baf3b8f84a61281056746fec48a5 /internal/pipeline/pipeline.go | |
parent | 72e7949b8ce84bb0742b977c3827fda6ca0a752e (diff) |
Add test for upAndQueue function
This involved adding a test queue, so it can be run safely without
intefering with the pipeline.
Diffstat (limited to 'internal/pipeline/pipeline.go')
-rw-r--r-- | internal/pipeline/pipeline.go | 7 |
1 files changed, 7 insertions, 0 deletions
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) |