Skip to content

Every task iteration flows have not local scope #32

@behrad

Description

@behrad

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]"]
            }
        ]
    }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions