From b5d712cb5a2cad026a2965ab52964e63ca0c6fe0 Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 16 Oct 2019 15:40:07 +0100 Subject: Ensure files are promptly closed by booktopipeline --- cmd/booktopipeline/main.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/booktopipeline/main.go b/cmd/booktopipeline/main.go index 6d9f146..6e10475 100644 --- a/cmd/booktopipeline/main.go +++ b/cmd/booktopipeline/main.go @@ -127,6 +127,10 @@ func main() { if err != nil { log.Fatalln("Failed to upload", path, err) } + // Explicitly close here rather than wait for the defer, so we + // don't end up with too many open files which can cause os.Open + // to fail. + file.Close() } verboselog.Println("Sending message", bookname, "to queue", qurl) -- cgit v1.2.1-24-ge1ad