Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; get data from archai DB
- ;; put data to elastic DB
- ;; it is slow so i have to do async
- ;; issue
- ;; i have to start sync BAR when FOO finished
- ;; How?
- (defn archai->elastic-refresh []
- (let [epochs (archai/generate-epochs epochs-from-now)
- in-archai (chan 100)
- out-elastic (chan 100)
- archai->elastic (fn [input out*]
- ;; todo
- ;; here convert archai into elastic data in #()
- (archai/fetch-epoch #(>!! out-elastic %) input)
- (close! out*))
- worker (dotimes [_ workers-elastic]
- (go-loop []
- (let [input (<! out-elastic)]
- (when-not (nil? input)
- (<! (thread
- (try
- (elastic/archai->push input)
- (catch Throwable ex
- (l/error ex)))))
- (recur)))))]
- (pipeline-async workers-archai out-elastic archai->elastic in-archai)
- (doseq [epoch epochs]
- (>!! in-archai {:url (archai/make-url {:stream "FOO"
- :epoch epoch})}))
- ;; todo
- ;; be sure first one end
- #_(doseq [epoch epochs]
- (>!! in-archai {:url (archai/make-url {:stream "BAR"
- :epoch epoch})}))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement