Partially re-initializing a running system (with Integrant)

(halt! system [D]) will halt A, B, C, D in that order.
(init config [D]) will init only D, and your system will have only 1 key.

But say you figure out that beside D you also need to init A, B, C (it would be nice if these functions were public). What if your config has an independend key E? If you run (init config [A B C D]) you have lost your E.

So my approach is something along the lines:
(merge (apply dissoc system changed-keys) (init config changed-keys)).

And it works pretty well.

Oh I see, I thought (init config [D]) would also init A,B and C since they are dependent on D.

init automatically starts dependencies, whereas halt! automatically stops dependents.

So, (init config [A]) would start A, B, C and D.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.