diff options
author | Nick White <git@njw.name> | 2019-10-16 15:59:40 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-10-16 15:59:40 +0100 |
commit | 0419aee83e1a3bc5f256480cc9591f19e97cbc5e (patch) | |
tree | 501fa7576a3f3982f688a8a04d29827229fc97e2 | |
parent | b5d712cb5a2cad026a2965ab52964e63ca0c6fe0 (diff) |
Another attempted fix to "too many open files" issue
-rw-r--r-- | cmd/booktopipeline/main.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/booktopipeline/main.go b/cmd/booktopipeline/main.go index 6e10475..a455966 100644 --- a/cmd/booktopipeline/main.go +++ b/cmd/booktopipeline/main.go @@ -118,7 +118,7 @@ func main() { if err != nil { log.Fatalln("Open file", path, "failed:", err) } - defer file.Close() + //defer file.Close() // done explicitly below _, err = uploader.Upload(&s3manager.UploadInput{ Bucket: aws.String("rescribeinprogress"), Key: aws.String(filepath.Join(bookname, name)), @@ -130,7 +130,10 @@ func main() { // 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() + err = file.Close() + if err != nil { + log.Fatalln("Failed to close file", path, err) + } } verboselog.Println("Sending message", bookname, "to queue", qurl) |