mount

jimrthy 2019-08-24T17:14:36.009900Z

Cross-post from #cider I just got an excuse to dive into a lot of new libraries/frameworks after only dabbling in clojure for 2-3 years. Fulcro led me to mount. Swagger led me back to Immutant (which I've really enjoyed using) and reitit. I'm not sure how obscure this stack really is. Maybe it would be "mainstream" (for clojure) if I switched from Immutant to Jetty (I'll probably try that for grins after I post this, just to see). When I manually run (stop), recompile my http-server ns, and then run (start), everything works the way I expect. When I just C-c C-k (yes, I'm using CIDER) to compile the ns, (stop) does not get called. So compilation fails because the port is already bound. Is this normal? Am I doing something wrong? Is this just a weird interaction between the way mount works and cider handles compilation? Should I do something different? Thank you!

tolitius 2019-08-24T17:22:26.012Z

I don't think this is something with cider or mount but rather with the server release port bind timeout. this is somewhat common across servers. one thing you can do is to add ^{:on-reload :noop} for the server state which will not restart the server during the namespace recompilation

tolitius 2019-08-24T17:22:35.012300Z

here is an example: https://github.com/tolitius/hubble/blob/master/src/clj/hubble/server.clj#L51

tolitius 2019-08-24T17:23:27.013300Z

it still will restart the server on (mount/start) (mount/stop), but not on a namespace recompilation

jimrthy 2019-08-27T01:51:28.013900Z

Awesome, thank you!

tolitius 2019-08-27T02:21:22.014100Z

of course

tolitius 2019-08-24T17:24:08.013600Z

here is some docs about it: https://github.com/tolitius/mount#on-reload