问题描述
我创建了一个通过 cloudwatch 事件 cron 触发的 lambda 函数.在测试时,我发现 lambda 重试在超时的情况下不起作用.我想了解预期的行为是什么.如果超时,应该重试吗?
I have created a lambda function which is triggered through cloudwatch event cron.While testing I found that lambda retry is not working in case of timeout.I want to understand what is the expected behaviour.Should retry happen in case of timeout?
P.S 我已经浏览了 aws 站点上的文档,但仍然无法弄清楚https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html
P.S I have gone through the document on the aws site but still can't figure out https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html
推荐答案
找到了关于这个的 aws 文档,
Found the aws documentation on this,
给定事件源的错误处理取决于调用 Lambda 的方式.Amazon CloudWatch Events 配置为异步调用 Lambda 函数."
"Error handling for a given event source depends on how Lambda is invoked. Amazon CloudWatch Events is configured to invoke a Lambda function asynchronously."
"异步调用 – 异步事件在用于调用 Lambda 函数之前排队.如果 AWS Lambda 无法完全处理事件,它将自动重试两次调用,重试之间有延迟."
"Asynchronous invocation – Asynchronous events are queued before being used to invoke the Lambda function. If AWS Lambda is unable to fully process the event, it will automatically retry the invocation twice, with delays between retries."
所以在这种情况下应该重试.不知道我的 lambda 函数有什么问题,我只是删除并重新创建,这次重试工作.
So the retry should happen in this case. Not sure what was wrong with my lambda function , I just deleted and created again and retry worked this time.
这篇关于由 cloudwatch 事件触发时的 Aws lambda 重试行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!