Fork me on GitHub
#mount
<
2017-09-25
>
timgilbert16:09:46

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

timgilbert16:09:29

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

tolitius17:09:14

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

timgilbert17:09:33

Nope, it's just a plain map

timgilbert17:09:51

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

timgilbert17:09:26

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

timgilbert17:09:55

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

timgilbert17:09:05

But outside of it I see the actual value

timgilbert17:09:25

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

timgilbert17:09:11

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

timgilbert17:09:21

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

tolitius18:09:19

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?

tolitius18:09:41

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