I have an application which rotates through proxies on a per request basis.
Currently I have some code which is:
func (mon *Monitor) MassUrlRetrieve(n int, url string) (respBytes []byte) {
funnel := make(chan []byte)
go ProductRetrieveTimeout(TIMEOUT_RETRIEVE_URL, funnel)
for i := 0; i < n; i++ {
go mon.WrapGetUrlToChannel(funnel, url)
}
return <- funnel
}
which basically sends off multiple requests and returns the first one to respond/ timeout if none respond in a timely manner.
In WrapGetUrlToChannel
I create a new proxy url are assign it to mon
's client.tr.Proxy
.
My question is - is it safe to modify the transport of the client while requests are in flight? Or to be safe should I have a different transport and client for each proxy to make sure they do not interfere?