|
1 | 1 | (ns clojure.core.async.flow-monitor |
2 | 2 | (:require |
3 | 3 | [clojure.core.async :as async] |
4 | | - [clojure.core.async.flow :as flow] |
| 4 | + [clojure.core.async.flow :as async-flow] |
5 | 5 | [ring.util.response :as response] |
6 | 6 | [ring.middleware.content-type :refer [wrap-content-type]] |
7 | 7 | [ring.middleware.not-modified :refer [wrap-not-modified]] |
|
72 | 72 | (assoc k (mainline-chan-meta v)) |
73 | 73 | (assoc k (filter-state v (:filters @state))))) |
74 | 74 | {} |
75 | | - (flow/ping (:flow @state))))}) |
| 75 | + (async-flow/ping (:flow @state))))}) |
76 | 76 | (Thread/sleep 1000) |
77 | 77 | (recur s)) |
78 | 78 | (println "Ping loop stopped"))))) |
|
90 | 90 | (let [clj-data (transit-str-reader data) |
91 | 91 | action (:action clj-data)] |
92 | 92 | (case action |
93 | | - :inject (flow/inject (:flow @state) (:target clj-data) (edn/read-string (:data clj-data))) |
94 | | - :resume-proc (flow/resume-proc (:flow @state) (:pid clj-data)) |
95 | | - :pause-proc (flow/pause-proc (:flow @state) (:pid clj-data))))) |
| 93 | + :inject (async-flow/inject (:flow @state) (:target clj-data) (edn/read-string (:data clj-data))) |
| 94 | + :resume-proc (async-flow/resume-proc (:flow @state) (:pid clj-data)) |
| 95 | + :pause-proc (async-flow/pause-proc (:flow @state) (:pid clj-data))))) |
96 | 96 | :on-close (fn [ch status] |
97 | 97 | (swap! state assoc-in [:loop-ping?] false) |
98 | 98 | (swap! state update-in [:channels] disj ch)) |
|
145 | 145 | (let [state (atom default-state) |
146 | 146 | error-chan (:clojure.datafy/obj (meta (:error (:chans (d/datafy flow))))) |
147 | 147 | report-chan (:clojure.datafy/obj (meta (:report (:chans (d/datafy flow)))))] |
| 148 | + (async-flow/ping flow) |
148 | 149 | (swap! state assoc :flow flow :handlers handlers :filters filters :root root) |
149 | 150 | (report-monitoring state report-chan error-chan) |
150 | 151 | (let [server (httpkit/run-server (app state) {:port port |
|
0 commit comments