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

Delete Saga #8

Open
andretorres00123 opened this issue May 28, 2020 · 1 comment
Open

Delete Saga #8

andretorres00123 opened this issue May 28, 2020 · 1 comment

Comments

@andretorres00123
Copy link

Is any way to delete a saga in case in a step I want to stop the complete saga?

@dmerrill6
Copy link
Contributor

Hi @andretorres00123 !

Currently there's no set way to do what you mention. What's your use case? What do you want to do with the unfinished steps?

One option that comes to mind is:

Say for example that one of your steps is critical and if that fails all other steps should fail too. Then the recommended approach would be to do something like this:

const step1 = await saga.addStep(...)
const dependentStepPromises = workersArray.map(worker => {
  return saga.addStep(worker, [step1.id]);
}
await Promise.all(dependentStepPromises)

That way if step1 fails, all other steps won't be executed and the saga will be marked as failed.

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

2 participants