Fork me on GitHub
#mount
<
2016-05-10
>
jethroksy07:05:34

is there a way to list started states?

jethroksy07:05:37

hmm I could just deref the state

jethroksy07:05:09

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

jethroksy07:05:19

(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))

jethroksy07:05:33

start works perfectly, and the log prints

jethroksy07:05:02

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

jethroksy07:05:11

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

lgastako07:05:49

you have :end instead of :stop

jethroksy08:05:02

oh wow thanks for the catch haha

tolitius13:05:21

@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