@growsari/idempotency

1.0.4 • Public • Published

Idempotency Package

Sometimes, we have functions that, when executed repeatedly, produce unwanted results. To get around that, use this. It saves a response for 10 mins and prevents any duplicate calls made while executing the function.

Usage

Easiest way to use this is through the function makeIdempotent, wrapping your microservice controller function.


const { makeIdempotent } = require('@growsari/idempotency')

// ...

async function someController(params) {
  // ...
}

// ...

module.exports = {
  someController: makeIdempotent(testTimeout)
}

If you want to use your own logic in reading from the db, get the functions reserve and save, just take inspiration from how makeIdempotent is implemented. lol

Readme

Keywords

none

Package Sidebar

Install

npm i @growsari/idempotency

Weekly Downloads

67

Version

1.0.4

License

ISC

Unpacked Size

4.83 kB

Total Files

3

Last publish

Collaborators

  • gs.dwight.badua
  • leland.growsari
  • melyo
  • prasad.riktam
  • ddimaano.gs
  • madhugogineni