dataflo.ws
dataflo.ws copied to clipboard
Every task iteration flows have not local scope
It seems every.item is not locally bound for each iteration of $every, I have an every task in which the sub-flow may pause or wait... (consider a long-time sub-task in each every iteration)
I was supposing for each iterations as standalone closures. but this is causing some bugs happening in my flow, so I consider this pattern harmful and race-prone to every sub-flows using internal variables!
[
{
"$function":"Array",
"$args":[
"data", "must", "flow"
],
"$set":"data"
},
{
"$every": "{$data}",
"$tasks":[
{
"$class": "wait",
"secs": 1,
"$set": "ok_with_me"
},
{
"if": "[*ok_with_me]",
"$function": "console.print",
"$args": ["Every item: ","[*every.item]"]
}
]
}
]