summaryrefslogtreecommitdiff
path: root/internal/pipeline/pipeline.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2022-01-17 13:10:33 +0000
committerNick White <git@njw.name>2022-01-17 13:10:33 +0000
commitcbd4adcdf3b27fc157df526fcdcbac8d6b74bb81 (patch)
treef347d57cf259a5336c5cd3573fb4e9ba52571bdf /internal/pipeline/pipeline.go
parentdb68150149ae3a876962195b50721c17a19c9b63 (diff)
internal/pipeline: if a graph cannot be created, don't leave an empty graph.png file, and allow failure to download that as it won't be created in the case of a 1 page book, which is fine
Diffstat (limited to 'internal/pipeline/pipeline.go')
-rw-r--r--internal/pipeline/pipeline.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/pipeline/pipeline.go b/internal/pipeline/pipeline.go
index e1a2c40..d5e8e1c 100644
--- a/internal/pipeline/pipeline.go
+++ b/internal/pipeline/pipeline.go
@@ -467,11 +467,16 @@ func Analyse(conn Downloader) func(chan string, chan string, chan error, *log.Lo
}
defer f.Close()
err = bookpipeline.Graph(bestconfs, filepath.Base(savedir), f)
+ if err != nil {
+ _ = os.Remove(fn)
+ }
if err != nil && err.Error() != "Not enough valid confidences" {
errc <- fmt.Errorf("Error rendering graph: %s", err)
return
}
- up <- fn
+ if err == nil {
+ up <- fn
+ }
close(up)
}