Lambda queries do not reflect the database state

0

Hi,

I have a lambda that connects to an Amazon Aurora RDS instance and gets data from it. In the database, I have two tables, Student and Processed. My lambda query returns 5 students from the student table that have not been processed, i.e., their ids do not appear in the Processed table. I'm noticing that when I make an update to the Processed table the changes are not immediately reflected in the lambda result. That is, the lambda still returns students that have been marked as processed. Even though the data in the database has changed. I have verified the updated state of the database manually. Is it possible that the lambda is caching somewhere? I'm executing the lambda from the AWS console so there are no layers there.

I also noticed that if I make a minor change to the lambda code, save it, and then execute it, I get the correct results. Thanks for any help.

已提问 4 年前573 查看次数
1 回答
0

I figured it out. I was creating the session object outside the lambda handler which caused it to be cached. I moved session creation inside the handler and everything works now.

已回答 4 年前

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

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

回答问题的准则