juxt

dominicm 2021-04-09T09:43:37.013700Z

That error sounds familiar, but I don't remember why 🙂

dominicm 2021-04-09T09:44:17.013900Z

Very odd that it seems to be running your start function on stop

dominicm 2021-04-09T09:44:41.014100Z

> you'll need to make sure they're not coming from edn as symbols (e.g. by just assoc it on in your code portion). ^ this isn't relevant with the later sha I think 🙂

flowthing 2021-04-09T09:52:18.014300Z

Yeah, I'll try to find the time to dive into the problem next week.

dominicm 2021-04-09T10:06:11.014500Z

Ah, I see the problem

dominicm 2021-04-09T10:06:20.014700Z

http-kit returns a function, so clip is trying to reload it for you :)

dominicm 2021-04-09T10:08:12.014900Z

@flowthing This solved it:

(def other-system-config
  {:components
   {:handler `{:start (handler {})}
    :http '{:start (org.httpkit.server/run-server (clip/ref :handler) {:port 8080})
            :stop (this)}}
   :reloads
   `{clojure.lang.Fn repl/relodable-fn
     :http nil}})

flowthing 2021-04-09T10:09:10.015100Z

Ah, of course! Thanks, I’ll try that out.

dominicm 2021-04-09T10:09:15.015300Z

When this hits master, API might actually be more like:

(def other-system-config
  {:components
   {:handler `{:start (handler {})}
    :http '{:start (org.httpkit.server/run-server (clip/ref :handler) {:port 8080})
            :stop (this)
            :reload nil}}
   :reloads
   `{clojure.lang.Fn repl/relodable-fn}})
As I think it's important to localize how the reload works. On the fence about whether matchers should be predicate based or some such.

dominicm 2021-04-09T10:11:17.015500Z

Could definitely see some kind of "convention" where a team does:

(def other-system-config
  {:components
   {:handler/a `{:start (handler {})}
    :handler/b `{:start (handler {})}
    :router '{:start [["/about" (clip/ref :handler/a)]
                      ["/foobar" (clip/ref :handler/b)]]}
    :http '{:start (org.httpkit.server/run-server (clip/ref :handler) {:port 8080})
            :stop (this)
            :reload nil}}
   :reloads
   {(fn [k _v] (= "handler" (namespace k))) repl/relodable-fn}})

dominicm 2021-04-09T10:11:52.015700Z

General solution is good, but API is still open for debate.

dominicm 2021-04-09T10:18:19.015900Z

Could also add some data to the exception when this happens too, and fall back onto the original. Not sure if stop should operate on the original item or the wrapped one either…