Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional async flow for walker's ability #1342

Open
amadolid opened this issue Oct 4, 2024 · 0 comments
Open

Optional async flow for walker's ability #1342

amadolid opened this issue Oct 4, 2024 · 0 comments

Comments

@amadolid
Copy link
Collaborator

amadolid commented Oct 4, 2024

Currently, we trigger walker's ability synchronously. But in theory, walker's ability is technically a entry to a process.
Right now the behavior is
spawn_call -> visit the first ability the correspond to first node -> run the ability -> queue the nodes that needs to visit -> visit the ability correspond to the next node

Walker Sample {
    can enter1 with `root entry {
        visit -->;
    }

    can enter2 with A entry -> int {}
}

in background, this will trigger enter1(root) -> enter2(a) synchronously

how about we support creating event loop to support asynchronous flow

Walker Sample {
    can enter1 with `root entry {
        visit -->;
    }

    async can enter2 with A entry -> int {
        await here.some_async_ability();
    }
}

in background, it will still run synchronously however, it will be triggered something like this

enter1(root);
if iscoroutine(res := enter2(a)):
   # open a thread to have isolated eventloop to run `res`
   # wait until it's finished before going to next flow

in this approach, we can support async flows, libraries or modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant