batch window lower than 20s but lambda function is called in 20s interval

0

In lambda manual, there is:

If you're using a batch window and your SQS queue contains very low traffic, Lambda might wait for up to 20 seconds before invoking your function. This is true even if you set a batch window lower than 20 seconds.

What is the cause behind this? I asked chatGPT and Bard, but neither of them could give me a solid answer.

  • How is your visibility timeout configured?

  • It's 30 seconds by default

已提问 3 个月前155 查看次数
1 回答
0
已接受的回答

I think I get the root cause. Lambda is using long polling to get messages from SQS. it will wait for the message for up to 20 seconds. So even if there is no message during that time and a shorter batch window like 2 seconds has been set, the function will be invoked after 20 seconds with an empty message.

I will vote myself :-)

已回答 3 个月前

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

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

回答问题的准则