cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
hjaf Helper V
Helper V

Concurrency setting does not seem to be working

Is there some known issue about concurrency not working on multiple levels? e.g I have 3 levels of 'for each' and I'm wondering if that may cause the concurrency setting to not have any effect.  There is an array variable that the deepest for-each is appending. The "middle loop" resets the array on every iteration and it is obviously running simultaenously because the array only gets populated when the reset has taken place on all iterations, only now it gets populated by ALL of the iterations. 

 

I have set all the for-all loops to concurrency to 1 but the top-level loop runs keeps running rampant. 

 

4 REPLIES 4
v-lin-msft Post Prodigy
Post Prodigy

Re: Concurrency setting does not seem to be working

Hi @hjaf,

 

Could you share a screenshot of your flow configuration, please?

 

According to your description, do you want to have 3 for-each simultaneous run? You can click on this cross button and choose to add parallel branches.Annotation 2019-06-06 174609.png

 

Best Regards,

Community Support Team _ Lin Tu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hjaf Helper V
Helper V

Re: Concurrency setting does not seem to be working

No, there is a reason for nesting the loops, they are dependent. However, it looks like it was a misconception by me, The loops seem to run simultaneously, but using different environments, so the top level for-each will still start multiple loops running at the same time, but the embedded loops do not proceed. The action by the top level loop is applied immediately, but then the sub-loops take some time, and the result is correct. But the concurrency setting seem to be an abstract, I guess that in reality it is optimizing resources and running at the same time when it can. 

Description about the Concurrency Control added to my confusion: "For each loops execute sequentially by default. Override the default setting to customize the degree of parallelism." So it will run sequentially by default, yet there is a warning about variable settings because of concurrency..? And wouldn't saying that a loop is run sequentially, be like saying that a loop loops? 


Anyways, do I understand the description correctly in that the loop is running as if the concurrency setting was set at 1 by default?

 

Microsoft
Microsoft

Re: Concurrency setting does not seem to be working

Hello,

You initialize the variables outside the for each loop, giving them a somewhat global scope. This means that if you do set variable or append variable inside a loop that is running parallel you might end up affecting all loops because of the variable's context being accessible in a global way.

This is my take on concurrency concept from programming point of view and what i have seen flow doing.
ManishJain Resolver I
Resolver I

Re: Concurrency setting does not seem to be working

Agreed,

 

Instead of using Set variable inside loop compose action works. the expression that you are using to set variable can be used in compose as well. 

 

Ref : https://toonvanhoutte.wordpress.com/2018/02/20/variables-in-parallel-for-each-loops/comment-page-1/?...

 

Thanks

Helpful resources

Announcements
Did you attend MBAS? Claim your badge

Attending MBAS? Claim your badge

Whether you’ve streamed the digital event live, or you're watching on-demand, claim your attendee badge to sport on your profile.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (6,017)