mount

timgilbert 2017-09-25T16:33:46.000139Z

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

timgilbert 2017-09-25T16:34:29.000346Z

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

tolitius 2017-09-25T17:27:14.000329Z

> inside of a (go-loop) the component shows up as a mount.core.NotStartedState which component, you mean a channel?

timgilbert 2017-09-25T17:44:33.000285Z

Nope, it's just a plain map

timgilbert 2017-09-25T17:45:51.000389Z

So like I have (defcomponent config :start (load-config-from-edn))

timgilbert 2017-09-25T17:46:26.000434Z

My test fixtures do a (mount/start #'config-ns/config) and then run some code which kicks off a (go-loop)

timgilbert 2017-09-25T17:46:55.000642Z

Inside of the go-loop, when I print the value of config I see a NotStartedState

timgilbert 2017-09-25T17:47:05.000460Z

But outside of it I see the actual value

timgilbert 2017-09-25T17:48:25.000293Z

I'm also often running under lein test-refresh so it's possible I've hosed up start/stop logic somewhere without realizing it

timgilbert 2017-09-25T17:51:11.000437Z

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

timgilbert 2017-09-25T17:53:21.000102Z

Hmm, and actually now that I've played with it some the problem disappeared 😐

tolitius 2017-09-25T18:28:19.000291Z

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?

tolitius 2017-09-25T18:30:41.000113Z

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