We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6581387 + 7106b95 commit f9898dcCopy full SHA for f9898dc
proxy/proxy.go
@@ -29,8 +29,9 @@ type roundRobinSwitcher struct {
29
}
30
31
func (r *roundRobinSwitcher) GetProxy(pr *http.Request) (*url.URL, error) {
32
- u := r.proxyURLs[r.index%uint32(len(r.proxyURLs))]
33
- atomic.AddUint32(&r.index, 1)
+ index := atomic.AddUint32(&r.index, 1) - 1
+ u := r.proxyURL[index%uint32(len(r.proxyURLs))]
34
+
35
ctx := context.WithValue(pr.Context(), colly.ProxyURLKey, u.String())
36
*pr = *pr.WithContext(ctx)
37
return u, nil
0 commit comments