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

Maintenance: align timestamp formats for expiration and in_progress_expiration in idempotency table #2298

Closed
RaphaelManke opened this issue Apr 1, 2024 · 5 comments · Fixed by #2574
Assignees
Labels
confirmed The scope is clear, ready for implementation enhancement PRs that introduce minor changes, usually to existing features good-first-issue Something that is suitable for those who want to start contributing idempotency This item relates to the Idempotency Utility

Comments

@RaphaelManke
Copy link

RaphaelManke commented Apr 1, 2024

Expected Behaviour

I'd expect that the values expiration and in_progress_expiration are using the same timestamp format

Current Behaviour

expiration uses float numbers
in_progress_expiration uses integer

{
 "id": "idempotency-powertools#jpdq6YAEvK9dodm3xTODpA==",
 "data": {
  "customerId": "111",
  "notificationId": "1072d969-8277-4d7c-b95b-abd716add0eb",
  "orderId": "ABC"
 },
 "expiration": 1711981471.834,
 "in_progress_expiration": 1711978111637,
 "status": "COMPLETED"
}

Code snippet

See docs examples.

Steps to Reproduce

  • Add Idempotency
  • Look at the dynamodb table

Possible Solution

No response

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

20.x

Packaging format used

npm

Execution logs

No response

@RaphaelManke RaphaelManke added triage This item has not been triaged by a maintainer, please wait bug Something isn't working labels Apr 1, 2024
@RaphaelManke RaphaelManke changed the title Bug: Different timestamp formats for expiration and in_progress_expiration Bug: Different timestamp formats for expiration and in_progress_expiration in idempotency table Apr 1, 2024
@dreamorosi
Copy link
Contributor

Hi @RaphaelManke thanks for opening this issue.

I need to triage this to know for sure, but I would assume that the two formats are different because one (expiration) is calculated by Powertools, while the other comes from the Lambda context (context.getRemainingTimeInMillis()).

Both timestamps are used in DynamoDB write conditions and compared against a unix timestamps generate using Date.now(), so the added precision of one of them should not cause issues.

I think we should probably make the two format consistent, however I'm trying to determine whether this is a bug or just a consistency issue.

Besides consistency and the inaccurate docs, have you encountered any bug related to this?

@dreamorosi dreamorosi added idempotency This item relates to the Idempotency Utility discussing The issue needs to be discussed, elaborated, or refined need-response This item requires a response from a customer and will considered stale after 2 weeks labels Apr 1, 2024
@RaphaelManke
Copy link
Author

No I didn't encountered a bug, but there was no other issue type matching 😃

@dreamorosi dreamorosi removed the need-response This item requires a response from a customer and will considered stale after 2 weeks label Apr 1, 2024
@dreamorosi
Copy link
Contributor

It's alright, it wasn't about the issue type - I just wanted to make sure this wasn't causing runtime bugs.

I'm going to label this as help-wanted, if anyone is interested in picking it up please leave a comment to let us know. We'll be happy to help you with any question or just review and merge your PR once it's ready.

As part of this task we should update the logic of this function so that the return value is rounded to an integer number.

@dreamorosi dreamorosi added good-first-issue Something that is suitable for those who want to start contributing help-wanted We would really appreciate some support from community for this one confirmed The scope is clear, ready for implementation enhancement PRs that introduce minor changes, usually to existing features and removed discussing The issue needs to be discussed, elaborated, or refined bug Something isn't working triage This item has not been triaged by a maintainer, please wait labels Apr 1, 2024
@dreamorosi dreamorosi changed the title Bug: Different timestamp formats for expiration and in_progress_expiration in idempotency table Maintenance: align timestamp formats for expiration and in_progress_expiration in idempotency table Apr 1, 2024
@arnabrahman
Copy link
Contributor

You can assign me @dreamorosi

@dreamorosi dreamorosi removed the help-wanted We would really appreciate some support from community for this one label May 22, 2024
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed The scope is clear, ready for implementation enhancement PRs that introduce minor changes, usually to existing features good-first-issue Something that is suitable for those who want to start contributing idempotency This item relates to the Idempotency Utility
Projects
Status: Coming soon
3 participants