AWS Lambda-发生故障时如何停止重试 [英] AWS Lambda - How to stop retries when there is a failure

查看:118
本文介绍了AWS Lambda-发生故障时如何停止重试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,当Lambda函数失败时(例如,超时),它会尝试再次运行该函数3次.有什么办法可以避免这种行为?我一直在阅读文档,但没有发现任何有关此的信息.

I know that when a Lambda function fails (for example when there is a time out), it tries to run the function 3 more times again. Is there any way to avoid this behavior? I' have been reading the documentation, but didn't find anyting about this.

谢谢!

推荐答案

编辑:现在可以更改lambda设置以禁用重试(请参见

EDITED: It's now possible to change the lambda settings to disable retries (see announcement)

原始答案:

无法禁用Lambda函数的重试行为. 我建议有两种解决方法:

There isn't a way to disable retry behavior of Lambda functions. I suggest two options to deal with that:

  1. 使Lambda能够正确处理重试案例.您可以使用context.AwsRequestId(或相应的字段),当重试Lambda时,它将是相同的.
  2. 将Lambda放入状态机中(使用AWS Step Functions).然后,您只能禁用重试. 此博客文章书面给出了更一般的解释.
  1. Make your Lambda able to handle retry cases correctly. You can use context.AwsRequestId (or corresponding field) that will be the same when a Lambda is retried.
  2. Put your Lambda inside a state machine (using AWS Step Functions). You can only then disable retries. This blog post I've written gives a more general explanation.

这篇关于AWS Lambda-发生故障时如何停止重试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆