diff options
author | Nick White <git@njw.name> | 2020-11-09 18:55:36 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-11-09 18:55:36 +0000 |
commit | f19df9e8c1213a49c426caefd2fadc711f5faf11 (patch) | |
tree | 9d4e60ff7550550880adb3f2b3a11b810de54167 /internal/pipeline | |
parent | a1de8862a091f9584220db40671a0d43346c4519 (diff) |
Switch Preprocess() to take the thresholds to use, and have rescribe tool only use 0.1,0.2,0.3separatelocal
Diffstat (limited to 'internal/pipeline')
-rw-r--r-- | internal/pipeline/pipeline.go | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/internal/pipeline/pipeline.go b/internal/pipeline/pipeline.go index b1c3cb9..cce5c19 100644 --- a/internal/pipeline/pipeline.go +++ b/internal/pipeline/pipeline.go @@ -146,22 +146,24 @@ func upAndQueue(c chan string, done chan bool, toQueue string, conn Pipeliner, b done <- true } -func Preprocess(pre chan string, up chan string, errc chan error, logger *log.Logger) { - for path := range pre { - logger.Println("Preprocessing", path) - done, err := preproc.PreProcMulti(path, []float64{0.1, 0.2, 0.4, 0.5}, "binary", 0, true, 5, 30, 120, 30) - if err != nil { - for range pre { - } // consume the rest of the receiving channel so it isn't blocked - errc <- err - return - } - _ = os.Remove(path) - for _, p := range done { - up <- p +func Preprocess(thresholds []float64) func(chan string, chan string, chan error, *log.Logger) { + return func(pre chan string, up chan string, errc chan error, logger *log.Logger) { + for path := range pre { + logger.Println("Preprocessing", path) + done, err := preproc.PreProcMulti(path, thresholds, "binary", 0, true, 5, 30, 120, 30) + if err != nil { + for range pre { + } // consume the rest of the receiving channel so it isn't blocked + errc <- err + return + } + _ = os.Remove(path) + for _, p := range done { + up <- p + } } + close(up) } - close(up) } func Wipe(towipe chan string, up chan string, errc chan error, logger *log.Logger) { |