I am initializing 2 array variables inside my power automate flow, when a SharePoint item is modified:-
then i am getting SharePoint list items, ApplyToEach on them, and inside each ApplyToEach iteration i am calling a child flow then append values to the 2 arrays based on the result of the child flow + value of the Apply to each, as follow:-
then after completing the ApplyToEach, i need to do some operations on the 2 array values.
now the "Concurrency control" is disabled inside the ApplyToEach:-
so is it fine if i enable it? for example to set it to 5? will it work with calling child flows and appending array variables based on the child flow result and based on the apply to each item value? or this might cause issues?
I'm going out on a limb and saying that yes, it's fine to set the concurrency control to On.
I tested with two flows, one looked like this ...
... the other without the random delay and in both cases, the concurrency control was set to 20.
The original array of data looked like this ...
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
These were the results ...
Scenario 1 (with random delay between 1 and 10 seconds)
[
3,
19,
7,
13,
6,
2,
14,
17,
11,
10,
8,
5,
9,
1,
12,
15,
18,
4,
16,
20
]
Scenario 2 (without delay)
[
6,
15,
5,
1,
8,
4,
3,
12,
17,
2,
7,
16,
13,
9,
20,
11,
14,
10,
19,
18
]
In both cases, the New Array
variable still held all values, not missing anything.
I would think this would be the best way to test as well given it's doing very little compared to running off and taking a different time per child flow execution given levels of complexity, etc.
To be completely frank, I wouldn't expect Microsoft to create a non thread safe implementation for the concurrency functionality in PA so I guess this kinda proves it.