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

feat(workflows-sdk): Configurable retries upon step creation #5728

Merged
merged 10 commits into from
Dec 19, 2023

Conversation

adrien2p
Copy link
Member

@adrien2p adrien2p commented Nov 27, 2023

What

  • Allow to create step that can be configured to have a max retry
  • Step end retry mechanism on permanent failure

Also added an API to override a step configuration from within the createWorkflow

const step = createStep({ name: "step", maxRetries: 3 }, async (_, context) => {
  return new StepResponse({ output: "output" })
})

const workflow = createWorkflow("workflow", function () {
  const res = step().config({ maxRetries: 5 }) // This will override the original maxRetries of 3
})

NOTE
We can maybe find another name than config on the step workflow data to override the step config.

Copy link

changeset-bot bot commented Nov 27, 2023

🦋 Changeset detected

Latest commit: b860dd3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@medusajs/orchestration Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Dec 19, 2023 9:26am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Dec 19, 2023 9:26am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Dec 19, 2023 9:26am

@adrien2p adrien2p marked this pull request as ready for review November 28, 2023 08:34
@adrien2p adrien2p requested a review from a team as a code owner November 28, 2023 08:34
@adrien2p adrien2p requested a review from olivermrbl December 15, 2023 09:23
Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending @srindom's approval

Please add a changeset.

Documentation will need to be updated too if/when merged cc @shahednasser :)

@adrien2p
Copy link
Member Author

@srindom let me know what do you think, would be nice to have for the poc to create async workflow with the new API

@srindom
Copy link
Collaborator

srindom commented Dec 19, 2023

I quite this! LGTM ✅

@kodiakhq kodiakhq bot merged commit 9cc787c into develop Dec 19, 2023
15 checks passed
@kodiakhq kodiakhq bot deleted the feat/workflow-sdk-configurable-step branch December 19, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants