-
Notifications
You must be signed in to change notification settings - Fork 148
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
Feature request: idempotent function wrapper #1305
Labels
completed
This item is complete and has been merged/shipped
feature-request
This item refers to a feature request for an existing or new utility
idempotency
This item relates to the Idempotency Utility
Milestone
Comments
As far as I can tell with #1540 we completed the feature. Closing this for the time being. |
9 tasks
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
completed
This item is complete and has been merged/shipped
feature-request
This item refers to a feature request for an existing or new utility
idempotency
This item relates to the Idempotency Utility
Use Case
Users who can't or don't use class-based decorators or Middy should be able to make arbitrary functions idempotent by using a function wrapper. This wrapper, also known in the industry as higher-order function should take the function to be made idempotent as first argument and an object with options and configs as second one.
Solution/User Experience
The
makeFunctionIdempotent
function wrapper should be able wrap bothasync
andsync
functions. It should accept the wrapped function (aka the function to be made idempotent) as first argument, and an object with mandatorypersistenceStore
anddataArgument
, as well as an optionalconfig
one. The former should be an instance of any class that extendsBasePersistenceLayer
, the second should be a string that represents the argument to be used for idempotency (in the wrapped function), while the latter should be an instance of the classIdempotencyConfig
.Following the Powertools for Python implementation, the wrapper should:
POWERTOOLS_IDEMPOTENCY_DISABLED
env variable has a truthy value (usingEnvironmentVariableService
)IdempotencyHandler
IdempotencyHandler.handle()
methodThis last step will ensure that the
IdempotencyHandler
will perform all the actions needed to make the function idempotent.Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: