SHOW:
|
|
- or go back to the newest paste.
| 1 | ; non-blocking | |
| 2 | (def symbols | |
| 3 | "Get universe of symbols" | |
| 4 | - | (let [urls (map #(str "https://example.com/") |
| 4 | + | (let [urls (map #(str "https://example.com/" %) |
| 5 | '(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))] | |
| 6 | (future (into #{} (map #(% :Name)
| |
| 7 | (flatten | |
| 8 | (map #(% :body) | |
| 9 | (pmap client/get urls | |
| 10 | (repeat {:oauth-token (:access_token @access-token)
| |
| 11 | :throw-exceptions false | |
| 12 | :as :json-strict-string-keys | |
| 13 | :connection-manager cm}))))))))) | |
| 14 | ||
| 15 | (defn async-gets | |
| 16 | "Send urls to the connection manager" | |
| 17 | [urls] | |
| 18 | (future (pmap client/get urls (repeat {:oauth-token (:access_token @access-token)
| |
| 19 | :throw-exceptions false | |
| 20 | :as :json-strict-string-keys | |
| 21 | :connection-manager cm})))) | |
| 22 | ||
| 23 | ; blocking | |
| 24 | (def get-all-symbols | |
| 25 | (async-gets (take 1000 (map #(str "https://example.com/" %) @symbols)))) |