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

Async steps body #13

Open
obender opened this issue Jan 24, 2018 · 6 comments
Open

Async steps body #13

obender opened this issue Jan 24, 2018 · 6 comments

Comments

@obender
Copy link

obender commented Jan 24, 2018

Hi,
How to implement async step body... the system crashes when i add await to step body....

@danielgerlag
Copy link
Owner

Could you attach the problem code here?

@danielgerlag
Copy link
Owner

Hi,

I have successfully tested this

class HelloWorld extends workflow_es.StepBody {
    async run(context) {
        console.log("Hello World");
        await doSomethingAsync();
        return workflow_es.ExecutionResult.next();
    }
}

@twilroad
Copy link

@danielgerlag between steps, is a step will waiting for the previous step finished with async?

@danielgerlag
Copy link
Owner

yes it does, but if you call an async method or promise from within the step and don't await it, then it can't know about it

@twilroad
Copy link

twilroad commented Apr 2, 2018

so, it can not await for async method

@danielgerlag
Copy link
Owner

as you can see here:

https://github.com/danielgerlag/workflow-es/blob/master/core/src/services/workflow-executor.ts#L73

it does in fact await, but if you fail to await any nested async methods inside your step implementation, then it's your choice

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

3 participants