Created
February 9, 2017 16:52
-
-
Save jcf/aea2a9682ce6c65d57c905cccb25c885 to your computer and use it in GitHub Desktop.
Revisions
-
James Conroy-Finn created this gist
Feb 9, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ (defn slurp-log ([peer-client-config] (slurp-log peer-client-config 2000)) ([peer-client-config wait] (let [chan (clojure.core.async/chan) sub (onyx.api/subscribe-to-log peer-client-config chan) timeout (clojure.core.async/timeout wait) xs (clojure.core.async/<!! (clojure.core.async/go-loop [xs []] (let [[val ch] (clojure.core.async/alts! [chan timeout])] (if (= ch timeout) xs (recur (conj xs val))))))] (-> sub :env onyx.api/shutdown-env) xs)))