gpt4 book ai didi

azure - 逻辑应用中的嵌套 foreach 循环不应用并发控制设置

转载 作者:行者123 更新时间:2023-12-02 23:12:47 28 4
gpt4 key购买 nike

在逻辑应用程序中,我递归地运行文件夹来获取文件。因此,我有几个“foreach”连接器嵌套在另一个连接器中。外部 foreach 连接器(当并发:关闭或 20 个实例时),它并行运行以通过文件夹运行。但读取文件的内部 foreach 连接器速度太慢。

对于每个文件,需要 2-5 秒。对于 #2500 个文件,总共花费了 (2500 * 5) 秒。

最佳答案

我已向 Az 支持部门提出案例。他们正在指导以下文档。 https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#prerequisites .

摘录:

The "Foreach" loop can process a limited number of array items. Forthis limit, see Concurrency, looping, and debatching limits.

By default, iterations in a "Foreach" loop run at the same time, or inparallel. This behavior differs from Power Automate's Apply to eachloop where iterations run one at a time, or sequentially. However, youcan set up sequential "Foreach" loop iterations. For example, if youwant to pause the next iteration in a "Foreach" loop by using theDelay action, you need to set the loop to run sequentially.

The exception to the default behavior are nested loops whereiterations always run sequentially, not in parallel. To run operationsin parallel for items in a nested loop, create and call a child logicapp.

我通过将内部 foreach 连接器和代码块移动到其他逻辑应用程序来打破嵌套的 foreach 循环。现在,我们为两个逻辑应用程序提供了一个普通的 foreach 连接器。

它以惊人的速度和并发性完美运行。

关于azure - 逻辑应用中的嵌套 foreach 循环不应用并发控制设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68938710/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com