Commit 80bc1592 authored by vicotor's avatar vicotor

update idx.go.

parent 31102e46
......@@ -153,11 +153,6 @@ func (p *PageUsers) Request(tweetId string, next string, f req) ([]UserTask, err
// }
//}
// wait rate limit.
if rt != nil && rt.Remaining == 0 {
time.Sleep(time.Until(rt.Reset.Time().Add(500 * time.Millisecond)))
}
taskUser := userObjectToUserTask(users)
// 查询最新的一页 followers, 去历史中匹配。
......@@ -172,6 +167,14 @@ func (p *PageUsers) Request(tweetId string, next string, f req) ([]UserTask, err
}
return res, nil
}
slog.Info("Task to be continued", "tweet id", tweetId, "next", newNext)
// Check if we need to respect rate limits
if rt != nil && rt.Remaining <= 0 {
// Wait until the rate limit resets (plus a small buffer)
waitTime := time.Until(rt.Reset.Time().Add(500 * time.Millisecond))
time.Sleep(waitTime)
}
return p.Request(tweetId, newNext, f)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment