Skip to content
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

fix(idempotency): pass lambda context remaining time to save inprogress #1540

Merged
merged 5 commits into from
Jun 22, 2023
Merged

fix(idempotency): pass lambda context remaining time to save inprogress #1540

merged 5 commits into from
Jun 22, 2023

Conversation

am29d
Copy link
Contributor

@am29d am29d commented Jun 22, 2023

Description of your changes

In this PR we fix the issue to pass lambda context remaining execution time to save in progress. This only applies to function wrapper for now. We need to rework the entire decorator signature to extract the context, this will be handled in a separate PR.

Related issues, RFCs

Issue number: closes #1482

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my change is effective and works
  • The PR title follows the conventional commit semantics

Breaking change checklist

Is it a breaking change?: NO

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

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.

@boring-cyborg boring-cyborg bot added idempotency This item relates to the Idempotency Utility tests PRs that add or change tests labels Jun 22, 2023
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Jun 22, 2023
@github-actions github-actions bot added the bug Something isn't working label Jun 22, 2023
@@ -32,6 +32,7 @@ const idempotent = function (
const functionPayloadtoBeHashed = isFunctionOption(options)
? record[(options as IdempotencyFunctionOptions).dataKeywordArgument]
: record;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with the current signature (& the comment about future refactoring), can we not do any assertion when idempotentLambdaHandler is used on the second argument like we do for the fn wrapper?

Like, getting the second argument which might or might not be context (example), and then doing an assertion on its content (example).

Is it worth it? Should we not do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, adding args to check the context works. I have added a copy of isContext, it needs a better place. Exporting would mix wrapper and decorator imports. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine for now, we should probably move it to commons together with the other type guards I'm adding in #1528.

Let's leave this for now.

@am29d am29d requested a review from a team as a code owner June 22, 2023 12:28
@am29d am29d requested a review from dreamorosi June 22, 2023 12:30
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@dreamorosi dreamorosi merged commit d47c3ec into aws-powertools:main Jun 22, 2023
@dreamorosi dreamorosi linked an issue Jun 22, 2023 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idempotency This item relates to the Idempotency Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
None yet
2 participants