Hi all. I'm running into some trouble involving core.async and mount, where I (mount/start)
and everything seems fine, but then inside of a (go-loop)
the component shows up as a mount.core.NotStartedState
Do I need to (mount/start)
inside every go block? Seems like I'm hitting a threading problem, but I'm not sure how to resolve it
> inside of a (go-loop)
the component shows up as a mount.core.NotStartedState
which component, you mean a channel?
Nope, it's just a plain map
So like I have (defcomponent config :start (load-config-from-edn))
My test fixtures do a (mount/start #'config-ns/config)
and then run some code which kicks off a (go-loop)
Inside of the go-loop, when I print the value of config
I see a NotStartedState
But outside of it I see the actual value
I'm also often running under lein test-refresh
so it's possible I've hosed up start/stop logic somewhere without realizing it
I'm also thinking it might be a timing thing, like the go-loop kicks off and executes before the EDN file has finished processing
Hmm, and actually now that I've played with it some the problem disappeared 😐
I don't think (go-loop)
would introduce uncertainty into component's state. it could very well be lein test-refresh
stopping it without you realizing it. can you hook up logging (yourself or with https://github.com/tolitius/mount-up) and see when the state(s) are stopped/started?
I use (boot watch speak test)
which is similar to lein test-refresh
. I do usually run (boot watch speak test)
in a separate REPL, not just to avoid potential threading issues, but to also avoid any inconsistencies between dev and test classpath