Fork me on GitHub
#mount
<
2018-06-06
>
richiardiandrea00:06:18

little bit mount-rusty. Is this normal?

ep-cloud.system> (mount/start)
{:started ["#'ep-cloud.config/config" "#'ep-cloud.logging/parent-logger"]}
ep-cloud.system> (mount/stop)
{:stopped []}
No state is stopped

richiardiandrea01:06:44

I also see the following in the repl:

Lumo socket REPL listening at localhost:5044.
cljs.user=>  [5547.553s] [mount] >> starting.. #'ep-cloud.logging/logger (namespace was recompiled)
 [5547.915s] [mount] >> starting.. #'ep-cloud.logging$macros/logger (namespace was recompiled)

tolitius01:06:18

this usually happens when there are no :stop functions

tolitius01:06:43

i.e.

(defstate config :start (load-config))

richiardiandrea01:06:44

Oh, you know, I actually wanted to assign nil on stop

richiardiandrea01:06:56

But probably I am not doing it right simple_smile

richiardiandrea01:06:22

I need to wrap it in a fn I guess

tolitius01:06:49

it will still be "NotStartedState" after it is stopped though

richiardiandrea01:06:34

Well, my state is a map so I want to make sure that on stop it won't be filled anymore

tolitius01:06:23

a question and a comment (it might make sense in node world, but I'll still ask): * why do you need a state which is just a map? * after the state is stopped (given that you have a :stop function), mount will no longer be referencing this state (map in your case), unless there are other references to this map outside of "this var" it will be garbage collected

richiardiandrea01:06:27

The classic config case is a map as well..that is my use case basically it is a map created at start time

richiardiandrea02:06:08

Isn't that a thing :) ?

richiardiandrea02:06:31

So probably I don't need stop - you are right

tolitius02:06:36

yea, I usually don't stop config: https://github.com/tolitius/hubble/blob/master/src/clj/hubble/env.clj#L30 when I do "reset" it just reloads, but in some cases (in case of lumo) reset won't work, so you can have :stop function that could be anything to "make it stop"

tolitius02:06:43

(i.e. if :stop function is there, mount will know that this component needs to be stopped, so next time you are going to call start, it will reload the config )

tolitius02:06:24

(i.e. what I mean by reset is a tools.namespace thingy that refreshes vars in dev)

richiardiandrea02:06:37

Oh that's the missing piece, thank you!

richiardiandrea02:06:16

First time I am trying this in lumo for real as you can see simple_smile

richiardiandrea02:06:27

I mean in a real app

tolitius02:06:46

that's really exciting, once you are done 🙂 I would really appreciate a blog post or something so we all can learn

richiardiandrea02:06:43

Kk will try my best 😺 you have done a pretty good job so not many differences. I guess the only thing is that I need to use @ for the states

richiardiandrea02:06:57

Maybe I will discover more things moving forward ;)

tolitius02:06:59

yea, I actually like @ : )

richiardiandrea02:06:49

Me too, it makes more sense, akin to atom deref