Datetime inside lambda giving same time for different invocations.

0

I have a lambda function that writes to dynamodb and inside the lambda, I fetch current time and pass it as well with data as the write time. I have noticed that in the DB, the datetime for the write is same for multiple invocations although they were not together. at least a gap of few minutes was there before each invocation. however, in db, the datetime is the exact including seconds for a few calls that were within a timespan of 15 minutes or so. Can I know why?

已提問 1 年前檢視次數 462 次
2 個答案
0
已接受的答案

Are you getting the current time inside the handler or outside the handler? The code that runs outside the handler is invoked only once. In your case, you need to do it inside the handler.

If this is not the case, it would be good if you can share your code.

profile pictureAWS
專家
Uri
已回答 1 年前
profile pictureAWS
專家
已審閱 1 年前
0

Hey, thanks. It's outside the handler. I will put it inside.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南