部署期间正在运行的AWS lambda会发生什么情况?

部署期间正在运行的AWS lambda会发生什么情况?

问题描述:

如果我在运行旧版本的lambda时部署了新版本的lambda会发生什么?

What happens if I deploy new version of a lambda while the old one is running?

旧的被打扰了吗?还是将新事件用于处理下一个事件,而旧事件却好像什么也没发生一样?

Is the old one interrupted? Or will the new one be used to handle the next event while the old one runs as if nothing happened?

我找不到关于它的文档

我在AWS论坛上发布了相同的问题,并从AWS开发人员那里得到了回复

I posted the same question on the AWS forums and got this reply from AWS dev

这就是您的建议:使用开始时已使用的功能版本,可以完成飞行中的调用,而无需更改代码或中断代码.您可能会对遇到错误或限制的异步调用进行功能更改,因为重试可能会允许在下次尝试时使用新版本的功能.尽管我们不中止正在进行的调用,但我们将积极消除旧代码的副本;这通常在功能更新后的一分钟内发生.这意味着您最多可以体验5-6分钟(功能的最大持续时间,再加上一点点),可以使用两种版本.在那之后,您应该只看到新的(已部署的)版本正在执行.

It's what you suggest: In-flight invocations complete, without code changes or interruption, using the version of the function that was in place at the time they began. You can potentially have a function change for asynchronous invocations that experience errors or throttles, because a retry will potentially allow a new version of the function to be hit on the next attempt. While we do not abort in-flight invocations, we will aggressively eliminate copies of the old code; this typically happens within a minute of a function being updated. That means that for up to about 5-6 minutes (the max duration of a function, plus a little bit) you can experience either/both versions in use; after that, you should see only the new(ly deployed) version executing.

https://forums.aws.amazon.com/thread.jspa?threadID=270926&tstart=0