mount

richiardiandrea 2018-06-06T00:41:18.000118Z

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

richiardiandrea 2018-06-06T01:19:44.000129Z

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)

tolitius 2018-06-06T01:53:18.000111Z

this usually happens when there are no :stop functions

tolitius 2018-06-06T01:53:43.000051Z

i.e.

(defstate config :start (load-config))

richiardiandrea 2018-06-06T01:53:44.000154Z

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

richiardiandrea 2018-06-06T01:53:56.000278Z

But probably I am not doing it right :simple_smile:

richiardiandrea 2018-06-06T01:54:22.000097Z

I need to wrap it in a fn I guess

tolitius 2018-06-06T01:54:49.000219Z

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

richiardiandrea 2018-06-06T01:55:34.000226Z

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

tolitius 2018-06-06T01:58:23.000035Z

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

richiardiandrea 2018-06-06T01:59:27.000264Z

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

richiardiandrea 2018-06-06T02:00:08.000264Z

Isn't that a thing :) ?

richiardiandrea 2018-06-06T02:00:23.000082Z

I am ok with #2

richiardiandrea 2018-06-06T02:00:31.000233Z

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

tolitius 2018-06-06T02:04:36.000316Z

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"

tolitius 2018-06-06T02:06:43.000063Z

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

tolitius 2018-06-06T02:11:24.000219Z

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

richiardiandrea 2018-06-06T02:11:37.000210Z

Oh that's the missing piece, thank you!

richiardiandrea 2018-06-06T02:13:16.000264Z

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

richiardiandrea 2018-06-06T02:13:27.000087Z

I mean in a real app

tolitius 2018-06-06T02:14:46.000160Z

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

richiardiandrea 2018-06-06T02:15:43.000040Z

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

richiardiandrea 2018-06-06T02:15:57.000048Z

Maybe I will discover more things moving forward ;)

tolitius 2018-06-06T02:17:59.000040Z

yea, I actually like @ : )

richiardiandrea 2018-06-06T02:18:49.000253Z

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

tolitius 2018-06-06T02:18:56.000251Z

yep

1