Skip to content

Commit

Permalink
fix: http get
Browse files Browse the repository at this point in the history
  • Loading branch information
snakem982 committed Dec 7, 2024
1 parent 66c1ff1 commit caea31b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions backend/tools/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func ConcurrentHttpGet(url string, headers map[string]string) (all []byte, fileN
// 开启多线程请求
cLock := sync.Mutex{}
done := make(chan bool, 1)
length := 128
wg := sync.WaitGroup{}
wg.Add(2)
go func() {
Expand All @@ -184,7 +183,7 @@ func ConcurrentHttpGet(url string, headers map[string]string) (all []byte, fileN
content, name, err := HttpGetByProxy(url, headers)
if err == nil {
cLock.Lock()
if all == nil && len(content) > length {
if all == nil && len(content) > 0 {
all = content
fileName = name
}
Expand All @@ -199,7 +198,7 @@ func ConcurrentHttpGet(url string, headers map[string]string) (all []byte, fileN
content, name, err := HttpGet(url, headers)
if err == nil {
cLock.Lock()
if all == nil && len(content) > length {
if all == nil && len(content) > 0 {
all = content
fileName = name
}
Expand Down

0 comments on commit caea31b

Please sign in to comment.