integrant

zlrth 2018-06-10T13:58:31.000083Z

To halt-key! a particular thing, I think I need to have access to the big handler map, but halt-key! is only passed a key and a value. IIUC, it's passed its own key, and the return value of init-key.

2018-06-10T14:00:29.000127Z

What do you mean by “big handler map”?

zlrth 2018-06-10T14:02:43.000072Z

(defmethod ig/init-key :runners [_ {:keys [handler] :as opts}]
  (runners/start-one-run-after-another handler))
i'm using lambdacd for a little spike. the second param in that declaration is the desired thing.

zlrth 2018-06-10T14:02:57.000090Z

i'd love to know the domain term for that!

2018-06-10T14:03:50.000019Z

The configuration value is what I usually call it.

2018-06-10T14:04:00.000076Z

And the output from ig/init-key is the initiated value

zlrth 2018-06-10T14:04:29.000033Z

oh wait. I could write something like:

(defmethod ig/init-key :runners [_ {:keys [handler] :as opts}]
  (runners/start-one-run-after-another handler)
handler)

2018-06-10T14:05:39.000104Z

(defmethod ig/init-key :this.needs.to.be.namespaced/runners [_ {:keys [handler] :as opts}]
  {:runners (runners/start-one-run-after-another handler))
   :handler handler})

(defmethod ig/halt-key :this.needs.to.be.namespaced/runners [_ {:keys [handler]}]
  (runners/stop handler))

2018-06-10T14:05:44.000048Z

Right 🙂

zlrth 2018-06-10T14:06:08.000020Z

but of course! makes sense. thanks so much

2018-06-10T14:06:12.000112Z

Typically the return value from ig/init-key should contain everything you keep to clean up after itself.

2018-06-10T14:06:31.000018Z

Also it’s a good idea to namespace your keys, as unnamespaced keys can’t be inherited from.

zlrth 2018-06-10T14:06:51.000034Z

oh ok, neat