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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则