From caf9bf265b00e069ad1d21879e1123c4af954921 Mon Sep 17 00:00:00 2001 From: liwei Date: Wed, 24 Mar 2021 14:03:23 +0800 Subject: [PATCH] fix: retry --- download/http/envent.go | 11 ----------- download/http/fetcher.go | 2 ++ 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 download/http/envent.go diff --git a/download/http/envent.go b/download/http/envent.go deleted file mode 100644 index 8bc6b907..00000000 --- a/download/http/envent.go +++ /dev/null @@ -1,11 +0,0 @@ -package http - -import "github.com/monkeyWie/gopeed-core/download/base" - -type Event struct { - status base.Status -} - -func (e *Event) Status() base.Status { - return e.status -} diff --git a/download/http/fetcher.go b/download/http/fetcher.go index 97b2e2a2..983ee875 100644 --- a/download/http/fetcher.go +++ b/download/http/fetcher.go @@ -295,6 +295,8 @@ func (f *Fetcher) fetchChunk(index int) (err error) { // 请求失败重试 continue } + // 请求成功就重置错误次数,连续失败5次才终止 + i = 0 retry, err = func() (bool, error) { defer resp.Body.Close() for {