From d44cd8ded34657e16e6078a96705feec8e8a1fca Mon Sep 17 00:00:00 2001 From: Alessandro De Angelis Date: Tue, 21 Jan 2020 19:34:39 +0100 Subject: [PATCH] trying to fix #44 --- README.md | 16 ++++++++-------- internal/version/version.go | 2 +- pkg/core/core.go | 15 +++++++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 419c2c98..7aa390e0 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,17 @@ Download the latest release: -- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader) -- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader-osx) -- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader.exe) -- [Linux ARM](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader-linux-arm) -- [Linux ARM64](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader-linux-arm64) +- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader) +- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader-osx) +- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader.exe) +- [Linux ARM](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader-linux-arm) +- [Linux ARM64](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader-linux-arm64) Download the latest GUI release: -- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader-gui-linux-amd64) -- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader-gui-osx) -- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.21.0/comics-downloader-gui-windows.exe) +- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader-gui-linux-amd64) +- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader-gui-osx) +- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.21.1/comics-downloader-gui-windows.exe) Put the script under a folder. diff --git a/internal/version/version.go b/internal/version/version.go index 78b49b4d..0a5fb14e 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -2,4 +2,4 @@ package version // Tag specifies the current release tag. // It needs to be manually updated. -const Tag = "v0.21.0" +const Tag = "v0.21.1" diff --git a/pkg/core/core.go b/pkg/core/core.go index 884c43e6..75a0cd8d 100644 --- a/pkg/core/core.go +++ b/pkg/core/core.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "strings" + "time" "github.com/Girbons/comics-downloader/pkg/util" epub "github.com/bmaupin/go-epub" @@ -237,19 +238,21 @@ func (comic *Comic) DownloadImages(outputFolder string) (string, error) { return dir, err } + client := &http.Client{ + Transport: &http.Transport{ + MaxIdleConns: 11, + IdleConnTimeout: 30 * time.Second, + }, + } + for i, link := range comic.Links { if link != "" { - rsp, err := http.Get(link) + rsp, err := client.Get(link) if err != nil { return dir, err } defer rsp.Body.Close() - // retrieve the image from the response - if err != nil { - return dir, err - } - imgFile, err := os.Create(fmt.Sprintf("%04d-image.%s", i, format)) if err != nil { return dir, err