mirror of
https://github.com/vale981/stream
synced 2025-03-04 17:41:38 -05:00
slightly dirty tric to pass the test
This commit is contained in:
parent
6173ba060e
commit
ea240dffc1
2 changed files with 12 additions and 11 deletions
|
@ -137,6 +137,12 @@
|
||||||
; Monitoring ;
|
; Monitoring ;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defn- put-process-event!
|
||||||
|
[id data]
|
||||||
|
(a/put! master-monitor {:type :process-event
|
||||||
|
:id id
|
||||||
|
:event data}))
|
||||||
|
|
||||||
(defn- handle-process-error!
|
(defn- handle-process-error!
|
||||||
[event id]
|
[event id]
|
||||||
(when-let [proc (get-process! id)]
|
(when-let [proc (get-process! id)]
|
||||||
|
@ -146,6 +152,9 @@
|
||||||
:start-failed (diagnose-start-error (:message (:details event)) proc)
|
:start-failed (diagnose-start-error (:message (:details event)) proc)
|
||||||
nil)]
|
nil)]
|
||||||
|
|
||||||
|
(put-process-event! id {:type :new-problem
|
||||||
|
:problem problem})
|
||||||
|
|
||||||
(dosync
|
(dosync
|
||||||
(alter processes
|
(alter processes
|
||||||
(fn [procs]
|
(fn [procs]
|
||||||
|
@ -153,12 +162,6 @@
|
||||||
updated-proc (assoc proc :problems (conj (:problems proc) problem))]
|
updated-proc (assoc proc :problems (conj (:problems proc) problem))]
|
||||||
(assoc procs id updated-proc))))))))
|
(assoc procs id updated-proc))))))))
|
||||||
|
|
||||||
(defn- put-process-event!
|
|
||||||
[id data]
|
|
||||||
(a/put! master-monitor {:type :process-event
|
|
||||||
:id id
|
|
||||||
:event data}))
|
|
||||||
|
|
||||||
(defn- handle-status-event!
|
(defn- handle-status-event!
|
||||||
"Handles status `event`s from the process with the `id`."
|
"Handles status `event`s from the process with the `id`."
|
||||||
[id event]
|
[id event]
|
||||||
|
|
|
@ -42,10 +42,6 @@
|
||||||
(testing "starting a process (which will fail)"
|
(testing "starting a process (which will fail)"
|
||||||
(is (not (:success @(p/start! proc)))))
|
(is (not (:success @(p/start! proc)))))
|
||||||
|
|
||||||
(testing "problem diagnosis"
|
|
||||||
(is ((:problems (api/get-process! (:id proc)))
|
|
||||||
:ffmpeg-not-found)))
|
|
||||||
|
|
||||||
(testing "spilling junk into the monitor channel"
|
(testing "spilling junk into the monitor channel"
|
||||||
(a/>!! (:monitor proc) "junk"))
|
(a/>!! (:monitor proc) "junk"))
|
||||||
|
|
||||||
|
@ -61,7 +57,9 @@
|
||||||
(let [c (a/chan)]
|
(let [c (a/chan)]
|
||||||
(a/sub api/monitor :process-event c)
|
(a/sub api/monitor :process-event c)
|
||||||
(p/start! proc)
|
(p/start! proc)
|
||||||
(is (= (:id proc) (:id (a/<!! c))))))
|
(is (= (:id proc) (:id (a/<!! c))))
|
||||||
|
(is ((:problems (api/get-process! (:id proc)))
|
||||||
|
:ffmpeg-not-found))))
|
||||||
|
|
||||||
(testing "deleting the process"
|
(testing "deleting the process"
|
||||||
(is (api/delete-process! proc))
|
(is (api/delete-process! proc))
|
||||||
|
|
Loading…
Add table
Reference in a new issue