integrant

richiardiandrea 2023-09-19T15:51:14.725849Z

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

weavejester 2023-09-21T13:32:06.832609Z

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
wevrem 2023-09-19T16:31:58.678989Z

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

wevrem 2023-09-19T16:33:39.089369Z

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

richiardiandrea 2023-09-19T19:42:31.230539Z

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

richiardiandrea 2023-09-19T19:43:14.708699Z

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

richiardiandrea 2023-09-19T20:06:12.488379Z

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

richiardiandrea 2023-09-19T20:07:27.964799Z

I see why now, the original repl code wipes the whole system https://github.com/arichiardi/integrant-repl/blob/master/src/integrant/repl.clj#L70

wevrem 2023-09-19T23:23:58.115819Z

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.