Skip to content

Commit

Permalink
Add docs that mention attempt count in error handling sections (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams authored Oct 20, 2023
1 parent 72a7fca commit 4c26e18
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pages/docs/functions/retries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ export default inngest.createFunction(
);
```

## Attempt counter

Every time your function is executed, an `attempt` count is passed in as input, which is the current zero-based attempt number for this run.

The first attempt will be `0`, the second `1`, and so on. It is incremented every time the function throws an error and is retried.

```ts
inngest.createFunction(
{ id: "product-check" },
{ event: "product.check.requested" },
async ({ attempt }) => {
// `attempt` is the zero-based attempt number
}
);
```

If retries are caused by a step failing which then succeeds before retries are exhausted, `attempt` will reset back to `0`. See the [Errors within steps](#errors-within-steps) section below.

## Errors within steps

Steps are individually retried. That means Inngest will handle the type of error, just as above, but on the per-step basis.
Expand Down

1 comment on commit 4c26e18

@vercel
Copy link

@vercel vercel bot commented on 4c26e18 Oct 20, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

website – ./

website-inngest.vercel.app
website-git-main-inngest.vercel.app
inngest.vercel.app
www.inngest.com

Please sign in to comment.