summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-10-16 15:59:40 +0100
committerNick White <git@njw.name>2019-10-16 15:59:40 +0100
commit0419aee83e1a3bc5f256480cc9591f19e97cbc5e (patch)
tree501fa7576a3f3982f688a8a04d29827229fc97e2 /cmd
parentb5d712cb5a2cad026a2965ab52964e63ca0c6fe0 (diff)
Another attempted fix to "too many open files" issue
Diffstat (limited to 'cmd')
-rw-r--r--cmd/booktopipeline/main.go7
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)