-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
The start function hands indefinitely when a component returns a map containing a promesa channel.
Promesa channels act like seqs apparently?
To reproduce:
- Create a component that returns
{:a-chan (sp/chan)}from its::ds/startfunction. Wheresp/chanis https://funcool.github.io/promesa/latest/promesa.exec.csp.html#var-chan - Create another component that references the first one using a local-ref (with the goal of using
:a-chaninside it) - Start the donut system
(require '[donut.system :as ds])
(require '[promesa.exec.csp :as sp])
(ds/start
{::ds/defs {:group {:first {::ds/start (fn [_]
{:a-chan (sp/chan)})}
:second {::ds/start (fn [{::ds/keys [config]}]
{:got config})
::ds/config {:first [::ds/local-ref [:first]]}}}}})
;; Warning: evaling this will hang
Result: The eval of ds/start will never return, as it enters the sp/chan->seq function and blocks waiting for something to appear on the channel.
It seems that donut is seqing inside the map returned by the first component:
Line 217 in a69fcae
| (def ref-type (fn [v] (when (seqable? v) (first v)))) |
This triggers sp/chan->seq, which blocks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
