1.5.0
Summary
In this release we are happy to add support for Idempotency InProgressExpiration timestamp.
This field is required to prevent against extended failed retries when a Lambda function times out, Powertools for AWS Lambda (.NET) calculates and includes the remaining invocation available time as part of the idempotency record.
If a second invocation happens after this timestamp, and the record is marked as INPROGRESS, we will execute the invocation again as if it was in the EXPIRED state (e.g, expire_seconds field elapsed).
This means that if an invocation expired during execution, it will be quickly executed again on the next retry.
When decorating the handler with Idempotent attribute we will do it automatically by getting the RemainingTime
value from the ILambdaContext that is passed to the handler.
RemainingTime
is the remaining execution time till the function will be terminated. At the time you create the Lambda function you set maximum time limit, at which time AWS Lambda will terminate the function execution.
Information about the remaining time of function execution can be used to specify function behavior when nearing the timeout.
When using Idempotent attribute on another method to guard isolated parts of your code, you must use RegisterLambdaContext
available in the Idempotency
static class to benefit from this protection.
Here is an example on how you register the Lambda context in your handler:
Lambda request timeout diagram
Changes
🌟New features and non-breaking changes
- feat: Idempotency calculate remaining invocation available time as part of the idempotency record (#363) by @hjgraca
📜 Documentation updates
- feat: Idempotency calculate remaining invocation available time as part of the idempotency record (#363) by @hjgraca