Fork me on GitHub
#integrant
<
2023-09-19
>
richiardiandrea15:09:14

Hi there, is there a way to halt and re-init a single component when using integrant.repl? I have tried with the standard ig/halt! but it seems to stop the whole system...for some reason

weavejester13:09:06

Not currently. There is a PR for it, I believe, but it's difficult to implement while maintaining consistency. For example, what if someone runs (init :foo) and then (halt :bar) . It might be reasonable to support keys only on init, and then maintain a set of initiated keys.

👍 1
wevrem16:09:58

(From the https://github.com/weavejester/integrant#initializing-and-halting): Both init and halt! can take a second argument of a collection of keys. If this is supplied, the functions will only initiate or halt the supplied keys (and any referenced keys). For example:

(def system
  (ig/init config [:adapter/jetty]))

wevrem16:09:39

I’ve never actually used halt! supplying a collection of keys, but I assume it works as advertised.

richiardiandrea19:09:31

Well I tried the integrant.repl version (adding an arity, cause missing) but it does not seem to work

richiardiandrea19:09:14

I'll have to dig into it and before doing that I was wondering if noone else had a pattern for it

richiardiandrea20:09:12

The problem with other approaches is that you'd have to maintain your system and config as var somewhere in the repl, integrant.repl does that for you

wevrem23:09:58

Do you have an “expensive” system which is making you want to be able to halt/init just a single component? I was trying to think about why you would want that, because my (entire system) reset’s are very fast so I’ve never had a reason to cherry pick.