juxt

onetom 2020-05-29T08:43:33.132900Z

@dominicm it seems the juxt.clip.core/stop calls the component's stop function twice. is that intended? im cleaning up dbs from my stop functions and they are not idempotent, so they fail on the 2nd run.

(def cfg {:components
            {:wheel {:start {:part "wheel"}
                     :stop  prn}}})
  (def sys (clip/start cfg))
  (clip/stop cfg sys)

=> #'repl/cfg
=> #'repl/sys
{:part "wheel"}
{:part "wheel"}
=> {:wheel nil}
and the implementation indeed seems to simply repeat the stop operation:
(defn stopping-f
  [[k {:keys [stop]}]]
  (fn [rf acc]
    (stop! (get acc k) stop)
    (-> acc
        (rf k (stop! (get acc k) stop)))))
https://github.com/juxt/clip/blob/26cb6c926b42c8b8886149d5c65c6d6568ad1cc8/src/juxt/clip/impl/core.cljc#L337-L342

onetom 2020-05-29T08:47:16.134400Z

it seems to me that stopping-f is a reducer, but it only implements a 2-arity version, but the 1st (stop! (get acc k) stop) was intended for a single arity version or something...?

dominicm 2020-05-29T09:00:38.135Z

I've done something stupid it seems. I'll take a look this weekend.

👍 1
❤️ 1
onetom 2020-06-01T01:53:43.135300Z

made reminder for this issue: https://github.com/juxt/clip/issues/11