Feature request: add support for ReturnValuesOnConditionCheckFailure
in Idempotency
#1784
Labels
ReturnValuesOnConditionCheckFailure
in Idempotency
#1784
Is your feature request related to a problem? Please describe.
When working with the Idempotency utility, the current implementation performs 2 operations: one write and one read whenever it encounters an idempotent request after the first time.
This happens because the implementation hinges on making an optimistic write to set the request as "in progress" while using a condition expression. When there's already another item, the condition expression will fail and the error will be interpreted as a request that should not be retried.
When this happens, the utility then goes on by reading the existing previously inserted error. The entire flow I just described is represented here in this diagram.
Several months ago DynamoDB announced the ability to specify a
ReturnValuesOnConditionCheckFailure
parameter that allows the call to automatically return the item that made the write failImplementing this mechanism would allow the utility to bypass the second read and thus improve performance and materialize cost savings for end customers.
Describe the solution you'd like
Currently the feature is supported in both the TypeScript and Python versions of Powertools for AWS. Here's the implementation we have in TypeScript for example:
IdempotencyItemAlreadyExistsError
we re throwWe could add something similar here.
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: