mount

jethroksy 2016-05-10T07:23:34.000227Z

is there a way to list started states?

jethroksy 2016-05-10T07:36:37.000228Z

hmm I could just deref the state

jethroksy 2016-05-10T07:37:09.000229Z

I'm getting weird behaviour for my web-server state

jethroksy 2016-05-10T07:37:19.000230Z

(defn- start-web-server
  "Starts web server at port. Returns web server connection."
  [handler port]  
  (timbre/infof "Starting web server on port %d..." port)
  (http/start-server handler {:port port}))

(defn- stop-web-server
  "Stops web server"
  [conn]
  (timbre/info "Stopping webserver...")
  (.close conn))

(defstate web-server
  :start (start-web-server handler (Integer. (env :http-port)))
  :end (stop-web-server web-server))

jethroksy 2016-05-10T07:37:33.000231Z

start works perfectly, and the log prints

jethroksy 2016-05-10T07:38:02.000232Z

but when i do mount/stop the log doesn't print, and the state still becomes NotStartedState

jethroksy 2016-05-10T07:38:11.000233Z

so when I start it again I get bind address in use

lgastako 2016-05-10T07:53:49.000234Z

you have :end instead of :stop

jethroksy 2016-05-10T08:09:02.000236Z

oh wow thanks for the catch haha

lgastako 2016-05-10T08:13:20.000237Z

no problem

tolitius 2016-05-10T13:44:21.000238Z

@lgastako: thanks for chiming in :simple_smile: @jethroksy: in case you are in clj land, you can look at mount.tools.graph :https://github.com/tolitius/mount/issues/12#issuecomment-167150505

1👍