Skip to content

Commit

Permalink
Merge pull request #243 from capadong/fix-Request-RequestedTimes-error
Browse files Browse the repository at this point in the history
解决请求链深度不能超过RequestedTimes的错误
  • Loading branch information
zlzforever committed Mar 13, 2023
2 parents 2d9d220 + 538fc0c commit 82c0a2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DotnetSpider/Spider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ protected async Task<int> AddRequestsAsync(IEnumerable<Request> requests)
$"Request {request.RequestUri}, {request.Hash} set to use PPPoE but PPPoERegex is empty");
}

request.RequestedTimes += 1;

// 1. 请求次数超过限制则跳过,并添加失败记录
// 2. 默认构造的请求次数为 0, 并且不允许用户更改,因此可以保证数据安全性
if (request.RequestedTimes > Options.RetriedTimes)
Expand Down Expand Up @@ -475,6 +473,8 @@ private async Task<bool> HandleTimeoutRequestAsync()

foreach (var request in timeoutRequests)
{
request.RequestedTimes += 1;

Logger.LogWarning(
$"{SpiderId} request {request.RequestUri}, {request.Hash} timeout");
}
Expand Down

0 comments on commit 82c0a2a

Please sign in to comment.