inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
414 stars 41 forks source link

Add `debounce` config stub #338

Closed jpwilliams closed 12 months ago

jpwilliams commented 12 months ago

Summary

Adds support for debounce by adding the simple config debounce.period and debounce.key made available in inngest/inngest#612.

inngest.createFunction(
  {
    id: "debounce-example",
    debounce: {
      period: "5m",
      key: "event.data.userId",
    },
  },
  { event: "app/something.happened" },
  async ({ event, step }) => {
    // ...
  }
);

Like concurrency and idempotency, debounce.key is just a string. We can later ensure that we provide typing based on the triggering event(s), similar to step.waitForEvent().

Checklist

Related

changeset-bot[bot] commented 12 months ago

🦋 Changeset detected

Latest commit: 66905bc78707c03d4b78826a65e66b43e5abd69f

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

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | inngest | Minor |

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

inngest-release-bot commented 12 months ago

A user has added the prerelease/inngest label, so this PR will be published to npm with the tag pr-338. It will be updated with the latest changes as you push commits to this PR.

You can install this prerelease version with:

npm install inngest@pr-338

The last release was built and published from 66905bc78707c03d4b78826a65e66b43e5abd69f.