-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: Idempotency calculate remaining invocation available time as part of the idempotency record #363
feat: Idempotency calculate remaining invocation available time as part of the idempotency record #363
Conversation
…aContext to Idempotency.cs. Add tests
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## develop #363 +/- ##
===========================================
+ Coverage 72.34% 72.66% +0.32%
===========================================
Files 82 82
Lines 3594 3644 +50
===========================================
+ Hits 2600 2648 +48
- Misses 994 996 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Nice work @hjgraca , LGTM 🤩 |
…' into idempotency-inprogressexpiration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, We should review dependency to Lambda Core prior to GA
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Issue number: #362
Summary
In the current implementation of Idempotency we don't have the InProgressExpiration timestamp. So currently if a lambda invocation expired there would be no way to retry it, when using the Idempotent attribute in the lambda handler or Idempotent attribute on another method
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.
Changes
User experience
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 theIdempotency
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
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.