I’m fetching url’s via proxies, where each agent’s state is a vector containing the proxy host and port it fetches from.
I’m trying to return the content’s of the page fetched while maintaining the agent’s state as the vector containing the host and port.
This is what I have so far.
(defn fetch-url-with-proxy [url]
(letfn [(fetch-fn [host-port url]
(let [[host port] host-port]
(fetch-url url host port)
host-port))]
(send-off (agent-from-pool proxy-pool) fetch-fn url)))
Unfortunately I currently return the agent, not the content of the fetch-url.
Any help would be appreciated!
Use a promise to wait for the result: