Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; non-blocking
- (def symbols
- "Get universe of symbols"
- (let [urls (map #(str "https://example.com/")
- '(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z))]
- (future (into #{} (map #(% :Name)
- (flatten
- (map #(% :body)
- (pmap client/get urls
- (repeat {:oauth-token (:access_token @access-token)
- :throw-exceptions false
- :as :json-strict-string-keys
- :connection-manager cm})))))))))
- (defn async-gets
- "Send urls to the connection manager"
- [urls]
- (future (pmap client/get urls (repeat {:oauth-token (:access_token @access-token)
- :throw-exceptions false
- :as :json-strict-string-keys
- :connection-manager cm}))))
- ; blocking
- (def get-all-symbols
- (async-gets (take 1000 (map #(str "https://example.com/" %) @symbols))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement