逻辑应用程序中的嵌套 foreach 循环不应用并发控制设置
Nested foreach loop in Logic Apps does not apply concurrency control setting
在逻辑应用程序中,我 运行 通过文件夹递归地获取文件。因此,我有几个 'foreach' 连接器嵌套在另一个连接器中。外部 foreach 连接器(当它是 concurrency:off 或 20 个实例时),它通过文件夹并行运行 运行。但是正在读取文件的内部 foreach 连接器太慢了。
对于每个文件,需要 2-5 秒。对于 #2500 个文件,总共花费了 (2500 * 5) 秒。
我已经向 Az Support 提出了一个案例。他们正在指导以下文档。 https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#prerequisites.
摘录:
The "Foreach" loop can process a limited number of array items. For
this limit, see Concurrency, looping, and debatching limits.
By default, iterations in a "Foreach" loop run at the same time, or in
parallel. This behavior differs from Power Automate's Apply to each
loop where iterations run one at a time, or sequentially. However, you
can set up sequential "Foreach" loop iterations. For example, if you
want to pause the next iteration in a "Foreach" loop by using the
Delay action, you need to set the loop to run sequentially.
The exception to the default behavior are nested loops where
iterations always run sequentially, not in parallel. To run operations
in parallel for items in a nested loop, create and call a child logic
app.
我通过将内部 foreach 连接器和代码块移动到其他逻辑应用程序来打破嵌套的 foreach 循环。现在,我们有一个用于两个逻辑应用程序的普通 foreach 连接器。
它以惊人的速度完美地并发运行。
在逻辑应用程序中,我 运行 通过文件夹递归地获取文件。因此,我有几个 'foreach' 连接器嵌套在另一个连接器中。外部 foreach 连接器(当它是 concurrency:off 或 20 个实例时),它通过文件夹并行运行 运行。但是正在读取文件的内部 foreach 连接器太慢了。
对于每个文件,需要 2-5 秒。对于 #2500 个文件,总共花费了 (2500 * 5) 秒。
我已经向 Az Support 提出了一个案例。他们正在指导以下文档。 https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#prerequisites.
摘录:
The "Foreach" loop can process a limited number of array items. For this limit, see Concurrency, looping, and debatching limits.
By default, iterations in a "Foreach" loop run at the same time, or in parallel. This behavior differs from Power Automate's Apply to each loop where iterations run one at a time, or sequentially. However, you can set up sequential "Foreach" loop iterations. For example, if you want to pause the next iteration in a "Foreach" loop by using the Delay action, you need to set the loop to run sequentially.
The exception to the default behavior are nested loops where iterations always run sequentially, not in parallel. To run operations in parallel for items in a nested loop, create and call a child logic app.
我通过将内部 foreach 连接器和代码块移动到其他逻辑应用程序来打破嵌套的 foreach 循环。现在,我们有一个用于两个逻辑应用程序的普通 foreach 连接器。
它以惊人的速度完美地并发运行。