@mccraigmccraig yes I think that i'm correctly shutting it down. Here is my server definition with integrant:
(defn create-aleph-server [aleph-config]
;; handler
;; middlewares...
;; returns aleph server
)
(defmethod ig/init-key ::aleph [_ aleph-config]
(create-aleph-server aleph-config))
(defmethod ig/halt-key! ::aleph [_ server]
(.close server))
(defmethod ig/suspend-key! ::aleph [_ server]
(.close server))
(defmethod ig/resume-key ::aleph [_key aleph-config _old-opts _old-impl]
(create-aleph-server aleph-config))
Every time I fire cider-refresh
, the server is killed and rebuilt (there is an Emacs hook with a local .dir-locals.el
file):
((nil . ((cider-ns-refresh-before-fn . "integrant.repl/suspend")
(cider-ns-refresh-after-fn . "integrant.repl/resume"))))
Also, if I'm not mistaken, cider-refresh
uses internally clojure.tools.namespace.repl/refresh
.
The weird thing is that on "simple" projects, this code works perfectly with aleph but with the heavier one (re-natal + web server + Datomic + integrant), aleph seems to get stuck randomly on dev with Spacemacs.i don't have any ideas @dam - your setup is quite different from mine. perhaps worth checking the socket is being released correctly when your server is .close
d
oh thanks
I never did that
Do you have any piece of advice to do that on Linux. What tool?
@dam it's a known bug
apparently it SOMETIMES breaks
i ran into this issue just today while debugging something else
oh thanks @vale, it seems to be exactly that