From 174d99f94b31cee8ca4b9f4a56e6d95d4ec51601 Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Sat, 18 Mar 2023 10:35:19 +0800 Subject: [PATCH] fix: add timeout setting for default http client --- internal/download/download.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/download/download.go b/internal/download/download.go index b94f53b..ff8a703 100644 --- a/internal/download/download.go +++ b/internal/download/download.go @@ -12,6 +12,7 @@ import ( "strconv" "strings" "sync" + "time" "github.com/pkg/errors" "github.com/tidwall/gjson" @@ -32,6 +33,7 @@ var client = &http.Client{ MaxIdleConns: 0, MaxIdleConnsPerHost: 999, }, + Timeout: time.Second * 5, } // ErrOverSize 响应主体过大时返回此错误